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

DataCloneError when doing a turbo frame navigation #85

Open
ibrahima opened this issue Feb 15, 2025 · 0 comments
Open

DataCloneError when doing a turbo frame navigation #85

ibrahima opened this issue Feb 15, 2025 · 0 comments

Comments

@ibrahima
Copy link

ibrahima commented Feb 15, 2025

This doesn't seem to affect anything as far as I can tell, but I noticed this when investigating #48. In the visitProposedToLocation function, when it's a turbo frame navigation, the options object has objects (request and snapshot) and functions (visitCachedSnapshot) inside of it, which I think can't be cloned, resulting in a DataCloneError being thrown.

this.postMessage("visitProposalRefreshingPage", { location: location.toString(), options: options })
is the line that is affected. I noticed that you can fix it by turning it into a pure JSON object a la https://stackoverflow.com/a/68468806/90551 but I didn't notice any different behavior after doing so. Still, it makes me wonder if something is lost along the way due to this, so I thought I'd report it. I wonder if it makes sense to "clean" objects sent to postMessage somewhere, or if a more pared down options object should be passed in somewhere upstream of this function in this case.

Thanks!

To reproduce:

  1. Set up a web app with turbo frame navigation
  2. Open the iOS app in simulator
  3. Connect to the app via Safari's debugging tools
  4. You should see the error in the JS console
Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant