react-async-states icon indicating copy to clipboard operation
react-async-states copied to clipboard

V2 notes

Open incepter opened this issue 2 years ago • 0 comments

After the v1, the v2 idea is:

The following are breaking changes:

  • No provider at all
  • Key is the definition of the state and there will be a pool where they are stored
  • enableDiscovery() makes the pool shareable in the whole v8 scope, which means, other instances from the library may connect to this shared pool and react to them (from vanilla js, angular ... and so on)
  • There is a second configurable pool of the instances that should be garbage collected that may be reused)
  • This second pool will be most often empty, and instances will live there for a configurable duration (5seconds for eg)
  • There will be a forward and backward compatibility bridges that will allow different versions of the app to work together
  • A global function configure would allow configuring pool sizes and durations etc... and even pointing the shared pool to use.

With no provider, hoist and fork subscription modes will no longer exist, and while discovering an instance of the main pool to use, the client application may remain and serve waiting instances until a delay passes (discovering the instance should be very fast).

API enhancements:

  • useAsyncState to control whether to create a state with no producer or to wait for it to be available
  • useSource would probably have an invalid source when still discovering from the client application

ROADMAP:

  • create core package with all base features
  • separate core package from react's one
  • adapt the react part
  • remove provider and do code

incepter avatar Sep 30 '22 10:09 incepter