YousefED / SyncedStore

SyncedStore CRDT is an easy-to-use library for building live, collaborative applications that sync automatically.
https://syncedstore.org
MIT License
1.69k stars 51 forks source link

Reactivity broken since updated @reactivedata/reactivity package released #114

Closed rcbevans closed 9 months ago

rcbevans commented 9 months ago

Recently I noticed a firehose of errors in the console about reactivity coming from syncedstore.

warning, Symbol($reactiveproxy) passed, but does not match $reactiveproxy. Multiple Reactive libraries loaded?

The basic functionality seems to be ok (I can store data in reactive arrays on a synced store, but reactivity seems to be broken, so after pushing items into the array, the UI no longer reactively rerenders until the host component rerenders.

    "@syncedstore/core": "^0.5.2",
    "@syncedstore/react": "^0.5.2",

Looking in yarn.lock I see

"@reactivedata/react@0.2.1":
  version "0.2.1"
  resolved "https://registry.yarnpkg.com/@reactivedata/react/-/react-0.2.1.tgz#886a1bea2dd8973baa45f75b76d17eaa847a9575"
  integrity sha512-nNnZaT3MDisDicXIX5/YvXZoVE0uO5LB47zTIs+hBnDRUAAYAzD8l+RcIa1YzouaOLK0yIx3ffwIvfGy/bJWjg==
  dependencies:
    "@reactivedata/reactive" "^0.2.0"

"@reactivedata/reactive@0.2.0":
  version "0.2.0"
  resolved "https://registry.yarnpkg.com/@reactivedata/reactive/-/reactive-0.2.0.tgz#1d370724bb0e3599b96b768bee96099f9326ed23"
  integrity sha512-qWmVSmUrjKHBiD+ZS8TxNNzyk9J6rbcZSZJgcnKQpTLwORZoWuX5pYbl07aU0kzXGLaaVX2O/ZW+SZaBjRQW3g==

"@reactivedata/reactive@^0.2.0":
  version "0.2.2"
  resolved "https://registry.yarnpkg.com/@reactivedata/reactive/-/reactive-0.2.2.tgz#19d953f691015152b92f8e699905519d99e3a1bd"
  integrity sha512-KnINM/Sng25QAv6sHkJO9q/XyslLegCF5jTsTSVu+AouY3uZDVf4Am99xNCqsfqFZFvnTBBDvCsHNdvTVGvPEA==

"@syncedstore/core@^0.5.2":
  version "0.5.2"
  resolved "https://registry.yarnpkg.com/@syncedstore/core/-/core-0.5.2.tgz#9c9bf8cca416ed38f1dcc8ff2c608ac36501ef6f"
  integrity sha512-gg1cJwhdwF806smc8xfuGk4bH4JRgKN7HqCt383ZvyA2MySEOlyvZf49XOdwz+zia4bE2T/oBfkcBNgZrQNubg==
  dependencies:
    "@reactivedata/reactive" "0.2.0"
    "@syncedstore/yjs-reactive-bindings" "^0.5.2"
    "@types/eslint" "6.8.0"

"@syncedstore/react@^0.5.2":
  version "0.5.2"
  resolved "https://registry.yarnpkg.com/@syncedstore/react/-/react-0.5.2.tgz#d6e077be53e959dcd7d49dbd301e43458f3c8807"
  integrity sha512-A1ufRZ33AnO6bTllfYOTEpHVrHQsPRg+oIWvZiAzUw1d5BCZYT3xoqPQmekZBsOScFORKCZp+ZUCUQTclT/ImQ==
  dependencies:
    "@reactivedata/react" "0.2.1"
    "@types/eslint" "6.8.0"

I believe this is because @reactivedata/react@0.2.1 loosely depends on "@reactivedata/reactive" "^0.2.0" which is resolving to "@reactivedata/reactive" "0.2.2" , but @syncedstore/core@^0.5.2 strictly depends on "@reactivedata/reactive" "0.2.0"

Changing the @syncedstore/core package.json to depend on ^0.2.0 should fix the issue I think.

rcbevans commented 9 months ago

For anyone running into this issue, adding the following to my root package.json forced yarn to resolve all resolutions of @reactivedata/reactive to 0.2.0, including @reactivedata/react. This resolved the reactivity version mismatches and the app is back to behaving as it should with reactive elements updating as they change.

  "resolutions": {
    "@reactivedata/reactive": "0.2.0"
  }
"@reactivedata/reactive@0.2.0", "@reactivedata/reactive@^0.2.0":
  version "0.2.0"
  resolved "https://registry.yarnpkg.com/@reactivedata/reactive/-/reactive-0.2.0.tgz#1d370724bb0e3599b96b768bee96099f9326ed23"
  integrity sha512-qWmVSmUrjKHBiD+ZS8TxNNzyk9J6rbcZSZJgcnKQpTLwORZoWuX5pYbl07aU0kzXGLaaVX2O/ZW+SZaBjRQW3g==
YousefED commented 9 months ago

@rcbevans could you see if syncedstore versions 0.6.0-alpha.0 work for you? If so, I'll ship those fixes

rcbevans commented 9 months ago

Give it a try and let you know.

YousefED commented 9 months ago

Give it a try and let you know.

Thanks! Keep me posted :)

rcbevans commented 9 months ago

Sorry for the delay. Yes the updated package.json dependency versions in 0.6-alpha resolve the version conflict.

YousefED commented 9 months ago

closed by https://github.com/YousefED/SyncedStore/pull/120