You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow one Collection schema to provide both argsKey and nestKey so it can be reused top-level and nested while preserving shared collection state.
Made-with: Cursor
`pk()` uses `argsKey(...args)`or `nestKey(parent, key)`, then serializes the result. Without either option, it defaults to `argsKey: params => ({ ...params })`, using all endpoint args as the collection key.
108
+
`pk()` uses `nestKey(parent, key)`when nested in an Entity and available; otherwise it uses `argsKey(...args)`, then serializes the result. Without options, it defaults to `argsKey: params => ({ ...params })`, using all endpoint args as the collection key. Provide both `argsKey` and `nestKey` to reuse one Collection definition top-level and nested.
109
109
110
110
-`argsKey` — derive pk from endpoint arguments (default)
111
111
-`nestKey` — derive pk from parent entity for nested shared-state collections
Copy file name to clipboardExpand all lines: .cursor/skills/data-client-v0.17-migration/SKILL.md
+38Lines changed: 38 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -146,6 +146,44 @@ These are rare; do them by hand:
146
146
147
147
`Schema.normalize()` and the `visit()` callback gain an optional trailing `parentEntity` parameter — the nearest enclosing entity-like schema, tracked automatically by the visit walker. Existing schemas don't need changes; new schemas can opt in.
148
148
149
+
### Optional Collection cleanup
150
+
151
+
`Collection` can now define both `argsKey` and `nestKey` on the same instance. During normalization it uses `argsKey` when top-level and `nestKey` when nested in an Entity, so paired definitions can be consolidated:
152
+
153
+
```ts
154
+
// before: two separate but equivalent Collections
0 commit comments