fix(ui): always render ProfileCropper in tree, use OnParametersSet to trigger JS init

This commit is contained in:
2026-07-09 13:20:54 +02:00
parent 3d3c59d58b
commit 56b80038a3
2 changed files with 17 additions and 10 deletions

View File

@@ -54,15 +54,13 @@
OnClosed="CloseAssetPicker" />
}
@if (showCropper && profileAssetId.HasValue) {
< ProfileCropper Show="true"
AssetId="profileAssetId"
CropX="cropX"
CropY="cropY"
CropZoom="cropZoom"
OnCropped="OnCropped"
OnClosed="CloseCropper" />
}
<ProfileCropper Show="showCropper && profileAssetId.HasValue"
AssetId="profileAssetId"
CropX="cropX"
CropY="cropY"
CropZoom="cropZoom"
OnCropped="OnCropped"
OnClosed="CloseCropper" />
@code {
/// <summary>

View File

@@ -89,8 +89,17 @@
_instanceId = ++_counter;
}
protected override void OnParametersSet() {
if (Show && AssetId.HasValue) {
_pendingInit = true;
}
}
bool _pendingInit;
protected override async Task OnAfterRenderAsync(bool firstRender) {
if (firstRender && Show && AssetId.HasValue) {
if (_pendingInit) {
_pendingInit = false;
await jsRuntime.InvokeVoidAsync("profileCropper.initialize",
ContainerId, ImageUrl, CropX ?? 50, CropY ?? 50, CropZoom ?? 1f);
}