inertia-rails icon indicating copy to clipboard operation
inertia-rails copied to clipboard

Rethinking Shared Data

Open bknoles opened this issue 9 months ago • 14 comments

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 by inertia_share.

bknoles avatar Apr 29 '24 00:04 bknoles