Skip to content

Commit

Permalink
feat(store): default off storeArgument (#1741)
Browse files Browse the repository at this point in the history
  • Loading branch information
holic authored Oct 12, 2023
1 parent 49c3e6c commit 7ce82b6
Show file tree
Hide file tree
Showing 56 changed files with 182 additions and 5,636 deletions.
26 changes: 26 additions & 0 deletions .changeset/angry-ladybugs-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
"@latticexyz/cli": patch
"@latticexyz/store": major
"@latticexyz/world-modules": patch
"@latticexyz/world": patch
"create-mud": patch
---

Store config now defaults `storeArgument: false` for all tables. This means that table libraries, by default, will no longer include the extra functions with the `_store` argument. This default was changed to clear up the confusion around using table libraries in tests, `PostDeploy` scripts, etc.

If you are sure you need to manually specify a store when interacting with tables, you can still manually toggle it back on with `storeArgument: true` in the table settings of your MUD config.

If you want to use table libraries in `PostDeploy.s.sol`, you can add the following lines:

```diff
import { Script } from "forge-std/Script.sol";
import { console } from "forge-std/console.sol";
import { IWorld } from "../src/codegen/world/IWorld.sol";
+ import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol";

contract PostDeploy is Script {
function run(address worldAddress) external {
+ StoreSwitch.setStoreAddress(worldAddress);
+
+ SomeTable.get(someKey);
```
128 changes: 0 additions & 128 deletions e2e/packages/contracts/src/codegen/tables/Multi.sol

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 0 additions & 59 deletions e2e/packages/contracts/src/codegen/tables/Number.sol

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7ce82b6

Please sign in to comment.