inertia-rails
inertia-rails copied to clipboard
Rethinking Shared Data
Continuing the conversation from #108
A quick summary:
- The combination of "module level" shared data storage, and "controller level" setters for shared data has introduced tricky bugs including shared data leaking across threads and across requests.
- While we've patched these issues, it'd be great to refactor away from global shared state.
- Controller class variables have been suggested in the past.
- I'm wary of using controller class variables, since in production they are also a form of global shared state.
- @PedroAugustoRamalhoDuarte has put together #111 , which refactors inertia shared state into instance variables. These are set via
before_action
callbacks, called byinertia_share
.