Recoil: Add support for multiple persistence types

Created on 7 Jun 2020  路  2Comments  路  Source: facebookexperimental/Recoil

Currently setting the persistence type is restricted to a discriminated union of either none or url. However, if we want to extend this such as adding a logging or local storage flag it means whatever is reading the url will not recognize it as being set. In addition, if we want to combine these extensions such as logging with url or local storage, all "plugins" need to be aware of this and have logic in them to deal with this.

My suggestion is to make the persistence type be a Set or Array so that anything needing to read this data can simply check if their flag is set in the atom.

Please let me know if I missed something or this can be accomplished in another way.

enhancement

Most helpful comment

We have a new persistence API coming out shortly that should be much more general, composable, and work for a wider range of situations. Please stay tuned!

All 2 comments

We have a new persistence API coming out shortly that should be much more general, composable, and work for a wider range of situations. Please stay tuned!

While we don't have the library published yet with multiple per-defined persistence types, this API is available to support this direction. (cc @bezi)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

art1373 picture art1373  路  4Comments

karevn picture karevn  路  3Comments

pesterhazy picture pesterhazy  路  4Comments

aappddeevv picture aappddeevv  路  3Comments

thegauravthakur picture thegauravthakur  路  3Comments