Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restoring snapshots from cookie is causing errors on the server #39

Open
matt-aitken opened this issue Sep 4, 2024 · 3 comments
Open

Comments

@matt-aitken
Copy link

This error is thrown:

TypeError: e.value.toNumber is not a function
    at ee (chunk-ZSHBCN6K.js:3:23605)
    at chunk-ZSHBCN6K.js:3:24762
    at Array.map (<anonymous>)
    at $r (chunk-ZSHBCN6K.js:3:24056)
    at chunk-ZSHBCN6K.js:3:39821
    at c (chunk-ZSHBCN6K.js:1:808)
    at chunk-ZSHBCN6K.js:1:1014
    at Object.useSyncExternalStore (chunk-LYHQCUWL.js:6:26399)
    at r.useSyncExternalStore (chunk-FTYKMG53.js:1:6374)
    at Os.useSyncExternalStoreWithSelector (chunk-ZSHBCN6K.js:1:1083)

Which seems to be from this code:

return `${unit.value.toNumber()}px`;

This is using this snapshot that is loaded from a cookie. I got this by going to the Inspector in Chrome and ticking "Show URL decoded". It looks to be in the same format as your test case ones:

{
  "status": "active",
  "value": "idle",
  "historyValue": {},
  "context": {
    "size": { "width": 0, "height": 0 },
    "items": [
      {
        "type": "panel",
        "min": { "type": "pixel", "value": "50" },
        "max": "1fr",
        "collapsible": false,
        "collapsedSize": { "type": "pixel", "value": "0" },
        "onCollapseChange": {},
        "onResize": {},
        "collapseIsControlled": false,
        "id": "tree",
        "default": { "type": "percent", "value": "0.5" },
        "currentValue": { "type": "pixel", "value": "-1" }
      },
      {
        "type": "handle",
        "size": { "type": "pixel", "value": "3" },
        "id": "tree-handle"
      },
      {
        "type": "panel",
        "min": { "type": "pixel", "value": "50" },
        "max": "1fr",
        "collapsible": false,
        "collapsedSize": { "type": "pixel", "value": "0" },
        "onCollapseChange": {},
        "onResize": {},
        "collapseIsControlled": false,
        "id": "timeline",
        "default": { "type": "percent", "value": "0.5" },
        "currentValue": { "type": "pixel", "value": "-1" }
      }
    ],
    "orientation": "horizontal",
    "dragOvershoot": "0",
    "groupId": "panel-run-tree",
    "autosaveStrategy": "cookie"
  },
  "children": {}
}

I think you might have the same error in the docs page for persistence, it's currently broken: https://react-window-splitter-six.vercel.app/docs/examples/persistance

@hipstersmoothie
Copy link
Owner

Our docs site seems to be hitting a different issue

@hipstersmoothie
Copy link
Owner

my gut says this is something like an incompatible breaking changes in the format

@hipstersmoothie
Copy link
Owner

If you delete the cookie does it persist?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants