stx-router 0.2.451 → 0.2.452

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.
Files changed (2) hide show
  1. package/dist/client.js +10 -0
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -1947,6 +1947,10 @@ else {
1947
1947
  document.body.innerHTML=bodyHTML;
1948
1948
  // Copy body attributes (class, data-stx, etc.)
1949
1949
  Array.from(newBody.attributes).forEach(function(attr){document.body.setAttribute(attr.name,attr.value)});
1950
+ // Copying only adds. data-stx names the page setup that stx:load falls
1951
+ // back to when no _latestSetup is set, so the outgoing page's name left
1952
+ // behind on a destination without one ran the page being left.
1953
+ if(!newBody.hasAttribute('data-stx'))document.body.removeAttribute('data-stx');
1950
1954
  // Update layout meta tag
1951
1955
  var oldMeta=qs(LAYOUT_META);
1952
1956
  var freshMeta=doc.querySelector(LAYOUT_META);
@@ -2135,6 +2139,12 @@ else {
2135
2139
 
2136
2140
  // Execute page scripts FIRST \u2014 they define setup functions and set _latestSetup
2137
2141
  function execScripts(){
2142
+ // The outgoing page's setup is not this page's. A destination whose
2143
+ // script defines no __stx_setup_ (a page that only calls useHead, say)
2144
+ // left it in place, and stx:load ran it again here: its effects, its
2145
+ // onMount -- HQ's calendar wrote ?athlete_id into /relax. Fragments
2146
+ // never hit this only because the server prepends the same clear.
2147
+ if(window.stx)window.stx._latestSetup=null;
2138
2148
  scripts.forEach(function(entry){
2139
2149
  var text=typeof entry==='string'?entry:entry.text;
2140
2150
  var runAlways=typeof entry==='string'?false:entry.runAlways;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stx-router",
3
3
  "type": "module",
4
- "version": "0.2.451",
4
+ "version": "0.2.452",
5
5
  "description": "File-based router for STX — .stx template discovery, nested layouts, typed route params, middleware, and client-side SPA navigation.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",