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

Disable state serialization for a request #148

Open
renatopeterman opened this issue Jul 25, 2016 · 6 comments
Open

Disable state serialization for a request #148

renatopeterman opened this issue Jul 25, 2016 · 6 comments

Comments

@renatopeterman
Copy link

Is it possible to disable the data-w-state serialization for a request?

@patrick-steele-idem
Copy link
Contributor

It is currently not possible to disable state serialization for a request/context, but it wouldn't be huge change to support that feature. With that said, we will be releasing a new minor version of Marko Widgets with a much-improved state/widget config serialization mechanism that supports circular dependencies and it will automatically de-dupe repeated objects. We hope to have the new version available in a week or two. Would you still want to disable state serialization if we optimized how state was serialized to the browser?

@renatopeterman
Copy link
Author

Great! I believe will not be necessary to disable state serialization once we have this improved serialization feature released. But, for now, would be very helpful to have it disabled. What would be the necessary changes to disable it?

@patrick-steele-idem
Copy link
Contributor

Any thoughts on the API for disabling state serialization? It would need to be set before rendering any components. Maybe introduce a tag that could be placed at the top of the page and that produces no output?:

<widgets-configure serialize-state=false/>

FYI, here is the related code:

/cc @mlrawlings @philidem

@renatopeterman
Copy link
Author

I like the idea, so I created the widgets-configure tag here: https://github.com/renatopeterman/marko-widgets/tree/issue-148
It works, but I'm not sure how danger it is to use out.global like this and I couldn't find a more elegant way to solve this right now. Any idea?

@patrick-steele-idem
Copy link
Contributor

Using out.global is the right thing to do, but it is probably better to namespace the config under a single property. Maybe out.global.widgetsConfig. If you make that change and maybe provide some docs and tests then I would have no objection to merging. Thanks for working on this

@patrick-steele-idem
Copy link
Contributor

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