@wcstack/router 4.14.0 → 4.16.0

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.
package/dist/index.esm.js CHANGED
@@ -78,7 +78,7 @@ function setConfig(partialConfig) {
78
78
  }
79
79
 
80
80
  var name = "@wcstack/router";
81
- var version = "4.14.0";
81
+ var version = "4.16.0";
82
82
  var pkg = {
83
83
  name: name,
84
84
  version: version};
@@ -1310,11 +1310,23 @@ function takenSet() {
1310
1310
  * `options` goes to the binder with the subtree. A subtree held for a later binder
1311
1311
  * is handed over without it: that binder's first walk of the page binds what is
1312
1312
  * still in place there.
1313
+ *
1314
+ * The queue holds what is in the document, each subtree once. The router offers a
1315
+ * route's content on every placement, so on a page that never loads a binder the
1316
+ * queue grew by every navigation, and kept the content of routes hidden since
1317
+ * (docs/formal-methods-study.md §8). A subtree that has left is dropped here: one
1318
+ * that comes back is offered again by whoever put it back.
1313
1319
  */
1314
1320
  function bindSubtree(subtree, options) {
1315
1321
  const binder = getBinder();
1316
1322
  if (binder === null) {
1317
- pendingQueue().push(subtree);
1323
+ const queue = pendingQueue();
1324
+ for (let i = queue.length - 1; i >= 0; i--) {
1325
+ if (!queue[i].isConnected)
1326
+ queue.splice(i, 1);
1327
+ }
1328
+ if (!queue.includes(subtree))
1329
+ queue.push(subtree);
1318
1330
  return false;
1319
1331
  }
1320
1332
  takenSet().add(subtree);