cheatcode / joystick

A full-stack JavaScript framework for building stable, easy-to-maintain apps and websites.
https://cheatcode.co/joystick
Other
209 stars 11 forks source link

Add a way to copy fetched data to state #368

Closed rglover closed 2 months ago

rglover commented 10 months ago

This comes up fairly often. There are situations with forms where data fetched from the server needs to be popped on to state. It'd be helpful to have a flag on a getter's options to say set_on_state. That would allow whatever we get back from the data function to just be placed on to state (and updated on refetch) automatically.

rglover commented 8 months ago

Consider the option being set_on_state_as where the value is the name of the state variable (e.g, set_on_state_as: 'books' copies the value to state.books).