From 50095a3a48872bf53c2043f0e07e09924f19a06e Mon Sep 17 00:00:00 2001 From: Nulo Date: Sun, 7 May 2023 20:29:21 -0300 Subject: [PATCH] SyncedStore --- SyncedStore.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 SyncedStore.md diff --git a/SyncedStore.md b/SyncedStore.md new file mode 100644 index 0000000..bdecc8c --- /dev/null +++ b/SyncedStore.md @@ -0,0 +1,21 @@ +## Gotchas + +Sadly, SyncedStore has a ton of gotchas that, due to the nature of the types that it has, TypeScript can't catch. + +### Array items don't exist after being removed + +```js +let normalArray = [{ a: "a" }, { b: "b" }, { c: "c" }]; +const item = normalArray[1]; // is {b:'b'} +normalArray.splice(2); +item; // is still {b:'b'} +``` + +while in SyncedStore land... + +```js +const anormalArray = $store.array; +const item = anormalArray[1]; // is {b:'b'} +anormalArray.splice(2); +item; // is undefined :( +```