Skip to content

Commit

Permalink
chore: delete store-cache package (#1343)
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed Aug 22, 2023
1 parent c32c8e8 commit e3de1a3
Show file tree
Hide file tree
Showing 28 changed files with 14 additions and 2,011 deletions.
7 changes: 7 additions & 0 deletions .changeset/metal-wombats-judge.md
@@ -0,0 +1,7 @@
---
"@latticexyz/store-cache": major
---

Removes `store-cache` package. Please see the [changelog](https://mud.dev/changelog) for how to migrate your app to the new `store-sync` package. Or create a new project from an up-to-date template with `pnpm create mud@next your-app-name`.

If you need reactivity, we recommend using `recs` package and `syncToRecs`. We'll be adding reactivity to `syncToSqlite` in a future release.
5 changes: 5 additions & 0 deletions .changeset/spicy-bees-teach.md
@@ -0,0 +1,5 @@
---
"@latticexyz/react": major
---

Removes `useRow` and `useRows` hooks, previously powered by `store-cache`, which is now deprecated. Please use `recs` and the corresponding `useEntityQuery` and `useComponentValue` hooks. We'll have more hooks soon for SQL.js sync backends.
28 changes: 0 additions & 28 deletions packages/react/README.md
Expand Up @@ -2,34 +2,6 @@

React hooks (and more) for building MUD clients.

## Hooks for `store-cache`

### useRows

Returns an array of all rows matching the provided filter. Re-renders if the filter changes or if table entries matching the provided filter change.

```typescript
// get a list of all entries in the database
const allRows = useRows(storeCache);
// -> [ { namespace: "", table: "Position", key: { key: "0x01" }, value: { x: 1, y: 2 } }, ... ]

// get a list of all entries in the Position table
const allPositionRows = useRows(storeCache, { table: "Position" });

// get a list of all entries in the position table with key greater than `0x0A`
const filteredRows = useRows(storeCache, { table: "Position", key: { gt: { key: "0x0A" } } });
```

### useRow

Returns a single row with the provided key in the provided table. Re-renders if the filter changes or if the value of this row changes.

```typescript
// get the Position value of key `0x01`
const position = useRow(storeCache, { table: "Position", key: { key: "0x01" } });
// -> { namespace: "", table: "Position", key: { key: "0x01" }, value: { x: 1, y: 2 } }
```

## Hooks for `recs`

### useComponentValue
Expand Down
1 change: 0 additions & 1 deletion packages/react/package.json
Expand Up @@ -24,7 +24,6 @@
"dependencies": {
"@latticexyz/recs": "workspace:*",
"@latticexyz/store": "workspace:*",
"@latticexyz/store-cache": "workspace:*",
"fast-deep-equal": "^3.1.3",
"mobx": "^6.7.0",
"react": "^18.2.0",
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/index.ts
Expand Up @@ -3,4 +3,3 @@ export * from "./useDeprecatedComputedValue";
export * from "./useEntityQuery";
export * from "./useObservableValue";
export * from "./usePromise";
export * from "./store-cache";
2 changes: 0 additions & 2 deletions packages/react/src/store-cache/index.ts

This file was deleted.

197 changes: 0 additions & 197 deletions packages/react/src/store-cache/useRow.test.ts

This file was deleted.

23 changes: 0 additions & 23 deletions packages/react/src/store-cache/useRow.ts

This file was deleted.

0 comments on commit e3de1a3

Please sign in to comment.