Improve signature handling and navigation stability
Updated button logic to display "Unterschreiben" only when signature fields exist. Changed `_signaturePopupVisible` to always be `false` for consistent popup behavior. Improved navigation after caching a signature by nullifying `_report`, adding a delay for UI updates, and using `forceLoad: true` for clean circuit teardown. These changes enhance user experience and prevent potential crashes.
This commit is contained in:
@@ -112,17 +112,17 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@* Unterschrift ändern button (when signature captured) *@
|
@* Unterschreiben button — visible only when signature fields exist *@
|
||||||
@if (_capturedSignature is not null)
|
@if (_signatures.Count > 0)
|
||||||
{
|
{
|
||||||
<button class="pdf-toolbar__btn pdf-toolbar__btn--signature-change pdf-toolbar__btn--signature-change-active"
|
<button class="pdf-toolbar__btn pdf-toolbar__btn--signature-change pdf-toolbar__btn--signature-change-active"
|
||||||
@onclick="OpenSignaturePopup"
|
@onclick="OpenSignaturePopup"
|
||||||
title="Unterschrift ändern"
|
title="Unterschreiben"
|
||||||
style="flex-shrink: 0;">
|
style="flex-shrink: 0;">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
|
||||||
<path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z" />
|
<path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z" />
|
||||||
</svg>
|
</svg>
|
||||||
<span class="pdf-toolbar__btn-text">Unterschrift</span>
|
<span class="pdf-toolbar__btn-text">Unterschreiben</span>
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -444,16 +444,16 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_activeSignatureTab = SignatureTabDraw;
|
_activeSignatureTab = SignatureTabDraw;
|
||||||
_signaturePopupVisible = _signatures.Count > 0;
|
_signaturePopupVisible = false;
|
||||||
_popupValidationMessage = null;
|
_popupValidationMessage = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.LogWarning(ex, "Failed to load cached signature for {EnvelopeKey}", EnvelopeKey);
|
Logger.LogWarning(ex, "Failed to load cached signature for {EnvelopeKey}", EnvelopeKey);
|
||||||
_activeSignatureTab = SignatureTabDraw;
|
_activeSignatureTab = SignatureTabDraw;
|
||||||
_signaturePopupVisible = _signatures.Count > 0;
|
_signaturePopupVisible = false;
|
||||||
_popupValidationMessage = null;
|
_popupValidationMessage = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -690,9 +690,15 @@
|
|||||||
Logger.LogInformation(
|
Logger.LogInformation(
|
||||||
"Signature cached with sid={Sid} for envelope {EnvelopeKey}", sid, EnvelopeKey);
|
"Signature cached with sid={Sid} for envelope {EnvelopeKey}", sid, EnvelopeKey);
|
||||||
|
|
||||||
// Navigate to signed page
|
// Null the report → DxReportViewer removed from DOM → no crash on dispose
|
||||||
|
_report = null;
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
await Task.Delay(50);
|
||||||
|
|
||||||
|
// Navigate — forceLoad:true for clean circuit teardown
|
||||||
Navigation.NavigateTo(
|
Navigation.NavigateTo(
|
||||||
$"/envelope/{Uri.EscapeDataString(EnvelopeKey!)}/signed?sid={sid}");
|
$"/envelope/{Uri.EscapeDataString(EnvelopeKey!)}/signed?sid={sid}",
|
||||||
|
forceLoad: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<string?> GetActiveSignatureDataUrlAsync()
|
async Task<string?> GetActiveSignatureDataUrlAsync()
|
||||||
|
|||||||
Reference in New Issue
Block a user