Recoil: Using useTransactionObservation_UNSTABLE, atomValues is empty

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

Using useTransactionObservation_UNSTABLE(observableAtoms), with

export const observableAtoms = (args) => {
  console.log(args)
}

I get:

atomInfo: Map(3) {"dateStart" => {鈥, "dateEnd" => {鈥, "currencyFormat" => {鈥}
atomValues: Map(0) {}
modifiedAtoms: Set(1) {"currencyFormat"}
previousAtomValues: Map(0) {}
transactionMetadata: {}

atomValues is empty, but from the persistence example (https://recoiljs.org/docs/guides/persistence), we should be able to get the atom from atomValues (atomValues.get(modifiedAtom))

Thoughts?

Most helpful comment

I believe they only show up in that after they're initialized (or perhaps if they're not in their initial state?), could be totally wrong with that though.

Looks like 0.0.9 is going to drop very soon with a re-implementation of this hook, so probably best to just sit tight.

All 2 comments

I believe they only show up in that after they're initialized (or perhaps if they're not in their initial state?), could be totally wrong with that though.

Looks like 0.0.9 is going to drop very soon with a re-implementation of this hook, so probably best to just sit tight.

For the deprecated API you need to also have a persistence_UNSTABLE property in the Atom with a type defined. The new hook simplifies this API, but 0.0.9 doesn't yet have the ability to iterate all atoms in the snapshot, there's another PR for that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yuantongkang picture yuantongkang  路  3Comments

tklepzig picture tklepzig  路  3Comments

thegauravthakur picture thegauravthakur  路  3Comments

julienJean99 picture julienJean99  路  3Comments

jamiebuilds picture jamiebuilds  路  3Comments