marko-js-archive / marko-widgets

[LEGACY] Module to support binding of behavior to rendered UI components rendered on the server or client
http://v3.markojs.com/docs/marko-widgets/
MIT License
142 stars 40 forks source link

Disable state serialization for a request #148

Open renatopeterman opened 8 years ago

renatopeterman commented 8 years ago

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

patrick-steele-idem commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

FYI: https://github.com/patrick-steele-idem/warp10