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
Copy file name to clipboardExpand all lines: config/.claude/skills/no-sql-web-sdk/SKILL.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ Keep local `references/...` paths for files that ship with the current skill dir
46
46
- Querying before the user is signed in when the collection rules require identity.
47
47
- Using `wx.cloud.database()` or Node SDK patterns in browser code.
48
48
- Initializing CloudBase lazily with dynamic imports instead of a shared synchronous app instance.
49
-
- For realtime UI, assuming the listener is ready immediately after calling `watch()`. Treat the first `onChange` snapshot whose `docChanges` contain `dataType: 'init'` as the initial data ready signal before rendering room state, enabling actions, or concluding that the query returned no rows.
49
+
- For realtime UI, assuming the listener is ready immediately after calling `watch()`. Treat the first `onChange` snapshot whose `snapshot.type === 'init'` as the canonical initial data ready signal before rendering room state, enabling actions, or concluding that the query returned no rows.
50
50
- Treating security rules as result filters rather than request validators.
51
51
- For CMS-style collections that need **app-level admin users** to edit/delete all records while editors can only edit/delete their own records, do not oversimplify the rule to `READONLY`. A validated pattern is a `CUSTOM` rule that reads role from `user_roles` by `auth.uid` and combines it with `doc.authorId == auth.uid`, while frontend writes can stay on `.doc(id).update()` / `.doc(id).remove()`.
52
52
- Forgetting pagination or indexes for larger collections.
@@ -122,7 +122,8 @@ Important rules:
122
122
123
123
5.**Handle realtime initialization explicitly**
124
124
-`.watch()` becomes usable only after the first `onChange` snapshot arrives.
125
-
- Use the snapshot whose `docChanges` include `dataType: 'init'` as the canonical "initial data is ready" event.
125
+
- Use the snapshot whose `type` is `init` as the canonical "initial data is ready" event.
126
+
- If you also inspect `docChanges`, the initial payload may include `dataType: 'init'`, but do not treat the query as ready before that first init snapshot arrives.
126
127
- Until that event arrives, keep loading state explicit and avoid enabling turn-based actions that depend on the queried documents.
Copy file name to clipboardExpand all lines: config/.claude/skills/no-sql-web-sdk/realtime.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,7 +92,8 @@ Create a real-time data listener that returns a `watcher` object.
92
92
93
93
Calling `.watch()` only starts the listener setup. Do not assume the queried data is ready immediately after `watch()` returns.
94
94
95
-
- Treat the first `onChange` snapshot whose `docChanges` contain `dataType: 'init'` as the canonical "initial data is ready" signal.
95
+
- Treat the first `onChange` snapshot whose `type` is `init` as the canonical "initial data is ready" signal.
96
+
- The initial payload may also include `docChanges` items with `dataType: 'init'`, but the listener is not ready until that first init snapshot arrives.
96
97
- Until that `init` snapshot arrives, keep loading state explicit.
97
98
- Do not enable turn-based actions, render room state as authoritative, or conclude that the query returned no rows before the `init` snapshot.
Copy file name to clipboardExpand all lines: config/source/skills/no-sql-web-sdk/SKILL.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ Keep local `references/...` paths for files that ship with the current skill dir
46
46
- Querying before the user is signed in when the collection rules require identity.
47
47
- Using `wx.cloud.database()` or Node SDK patterns in browser code.
48
48
- Initializing CloudBase lazily with dynamic imports instead of a shared synchronous app instance.
49
-
- For realtime UI, assuming the listener is ready immediately after calling `watch()`. Treat the first `onChange` snapshot whose `docChanges` contain `dataType: 'init'` as the initial data ready signal before rendering room state, enabling actions, or concluding that the query returned no rows.
49
+
- For realtime UI, assuming the listener is ready immediately after calling `watch()`. Treat the first `onChange` snapshot whose `snapshot.type === 'init'` as the canonical initial data ready signal before rendering room state, enabling actions, or concluding that the query returned no rows.
50
50
- Treating security rules as result filters rather than request validators.
51
51
- For CMS-style collections that need **app-level admin users** to edit/delete all records while editors can only edit/delete their own records, do not oversimplify the rule to `READONLY`. A validated pattern is a `CUSTOM` rule that reads role from `user_roles` by `auth.uid` and combines it with `doc.authorId == auth.uid`, while frontend writes can stay on `.doc(id).update()` / `.doc(id).remove()`.
52
52
- Forgetting pagination or indexes for larger collections.
@@ -122,7 +122,8 @@ Important rules:
122
122
123
123
5.**Handle realtime initialization explicitly**
124
124
-`.watch()` becomes usable only after the first `onChange` snapshot arrives.
125
-
- Use the snapshot whose `docChanges` include `dataType: 'init'` as the canonical "initial data is ready" event.
125
+
- Use the snapshot whose `type` is `init` as the canonical "initial data is ready" event.
126
+
- If you also inspect `docChanges`, the initial payload may include `dataType: 'init'`, but do not treat the query as ready before that first init snapshot arrives.
126
127
- Until that event arrives, keep loading state explicit and avoid enabling turn-based actions that depend on the queried documents.
Copy file name to clipboardExpand all lines: config/source/skills/no-sql-web-sdk/realtime.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,7 +92,8 @@ Create a real-time data listener that returns a `watcher` object.
92
92
93
93
Calling `.watch()` only starts the listener setup. Do not assume the queried data is ready immediately after `watch()` returns.
94
94
95
-
- Treat the first `onChange` snapshot whose `docChanges` contain `dataType: 'init'` as the canonical "initial data is ready" signal.
95
+
- Treat the first `onChange` snapshot whose `type` is `init` as the canonical "initial data is ready" signal.
96
+
- The initial payload may also include `docChanges` items with `dataType: 'init'`, but the listener is not ready until that first init snapshot arrives.
96
97
- Until that `init` snapshot arrives, keep loading state explicit.
97
98
- Do not enable turn-based actions, render room state as authoritative, or conclude that the query returned no rows before the `init` snapshot.
0 commit comments