@jsenv/navi 0.27.59 → 0.27.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14707,9 +14707,14 @@ const setupBrowserIntegrationViaHistory = ({
14707
14707
  const isSameUrl = url === window.location.href;
14708
14708
 
14709
14709
  if (navigationType === "push" || navigationType === "replace") {
14710
- // Pre-merge visited URLs so push/replaceState is called only once.
14710
+ // Merge onto the current state so existing useNavState entries (e.g. an
14711
+ // open dialog/popover) survive URL changes triggered by signal updates.
14712
+ // "traverse" is intentionally excluded: it restores the exact historical
14713
+ // state from the history entry, which is the source of truth for back/forward.
14714
+ const currentState = getDocumentState() || {};
14711
14715
  markUrlAsVisited(url);
14712
14716
  const effectiveState = {
14717
+ ...currentState,
14713
14718
  ...(state || {}),
14714
14719
  jsenv_visited_urls: Array.from(visitedUrlSet),
14715
14720
  };
@@ -36412,7 +36417,11 @@ const PickerCustom = props => {
36412
36417
  isClickOutside
36413
36418
  } = {}) => {
36414
36419
  const cancelEvent = findEvent(requestCloseEvent, eInChain => eInChain.type === "navi_request_close" && eInChain.detail.isCancel);
36415
- const isCancel = isClickOutside || Boolean(cancelEvent);
36420
+ // open_prop_change means the parent is driving the open state directly
36421
+ // (e.g. back-button navigation flipped openProp to false before onLeave fires).
36422
+ // Always treat it as cancel — the user's in-progress edit should be discarded.
36423
+ const isPropDrivenClose = requestCloseEvent.type === "open_prop_change";
36424
+ const isCancel = isClickOutside || Boolean(cancelEvent) || isPropDrivenClose;
36416
36425
  if (isCancel) {
36417
36426
  const pickerEl = ref.current;
36418
36427
  const inputEl = getPickerInput(pickerEl);