SyncedStore
This commit is contained in:
parent
b4a759e436
commit
50095a3a48
1 changed files with 21 additions and 0 deletions
21
SyncedStore.md
Normal file
21
SyncedStore.md
Normal file
|
@ -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 :(
|
||||
```
|
Reference in a new issue