restore(pagestack): restore pagestack for multiple navigation redirects (#2569)

This commit is contained in:
Qinyouzeng
2025-12-05 11:46:44 +08:00
committed by GitHub
parent 02f74185dc
commit 326e4cbdc6

View File

@@ -182,16 +182,11 @@ public partial class PPageStack : MasaComponentBase
InvokeAsync(StateHasChanged);
}
private bool _popstateExecuting = false;
[JSInvokable]
public void Popstate(string absolutePath)
{
if (_popstateExecuting) return;
_popstateExecuting = true;
if (Pages.Count == 0)
{
DelayPopstateExecute();
return;
}
@@ -216,7 +211,6 @@ public partial class PPageStack : MasaComponentBase
await Task.Delay(DelayForPageClosingAnimation); // wait for the transition to complete
Pages.RemoveRange(startIndex, delta);
await InvokeAsync(StateHasChanged);
_popstateExecuting = false;
});
return;
@@ -230,7 +224,6 @@ public partial class PPageStack : MasaComponentBase
Pages.RemoveRange(0, Pages.Count - 1);
InternalReplaceHandler(relativeUri, state);
_uriForReplaceAndClearStack = null;
DelayPopstateExecute();
return;
}
@@ -245,7 +238,7 @@ public partial class PPageStack : MasaComponentBase
replaceUri = GetAbsolutePath(replaceUri);
CloseTopPages(delta, disableTransition, state, replaceUri);
_uriForGoBackToAndReplace = null;
DelayPopstateExecute();
return;
}
@@ -272,7 +265,6 @@ public partial class PPageStack : MasaComponentBase
if (_popstateByUserAction)
{
_popstateByUserAction = false;
DelayPopstateExecute();
return;
}
@@ -281,16 +273,6 @@ public partial class PPageStack : MasaComponentBase
{
CloseTopPageOfStack();
}
DelayPopstateExecute();
}
private void DelayPopstateExecute()
{
_ = Task.Run(async () =>
{
await Task.Delay(150);
_popstateExecuting = false;
});
}
[JSInvokable("Scroll")]