Expensify/react-native-onyx

Onyx.merge('key', null) breaks subsequent merges for 'key'

arosiclair opened this issue ยท 8 comments

Codesandbox example

Rough steps:

  1. Init onyx
  2. Merge value on 'key'
  3. Merge null on 'key'
  4. Merge another value on 'key'
  5. See that 'key' never updates

This is reproducible on the latest version (v1.0.116) and at least as early as v1.0.100

The root of the problem seems to be here where a null change removes the key from Onyx but never clears the mergeQueue for the key. Subsequent merges just continue filling the queue without ever getting processed.

cc @chrispader since you're on the blame

Looks like this was introduced in v1.0.99 from this PR. cc @tgolen @neil-marcellini

tgolen commented

Thanks for digging into this and finding a problem @arosiclair. Let's be sure to start off with writing a test that reproduces the bug. @chrispader can you please look into this?

Yes, going to look into this either today or tomorrow! cc @arosiclair @tgolen

Just merged it thanks for putting a fix out quickly!

@chrispader can you also post a PR to bump our version of Onyx in NewDot?

@chrispader can you also post a PR to bump our version of Onyx in NewDot?

yes, will do ๐Ÿ‘

This is all set!