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
In Shiny, htmlDependency scripts are dynamically inserted via
document.createElement(), so document.currentScript is null. This broke
WASM/worker path detection and Parquet URL resolution.
Fixes:
- Add duckdb-locator.js as a separate script that runs before the webpack
bundle, with querySelector fallback for when currentScript is null
- Add runtime querySelector fallback in Reactable.js useEffect for both
wasmBasePath and parquetUrl resolution (DOM is populated by then)
- Fix Parquet locator script to also use querySelector fallback
- Suppress false positive preRenderHook warning when user explicitly
sets mode='client' (only warn for auto-resolved client mode)
Test updates:
- Add R test verifying backendDuckDB(mode='client') skips preRenderHook
- Add Shiny test apps for Arrow IPC and Parquet in client mode
- Update server-side-data plan doc with completed selection and client
mode work
When server-side search returns zero results, pagination shows "1-10 of 0 rows" instead of "0-0 of 0 rows".
165
167
166
168
#### 1.4 Stop Sending Unused State
167
-
**File:**`srcjs/Reactable.js` lines 1180-1183
169
+
**File:**`srcjs/Reactable.js`
170
+
171
+
~~Currently sends `expanded` and `selectedRowIds` in every request, but no backend uses them.~~**Done.**`selectedRowIds` has been removed from server requests and all backend signatures. `expanded` is still sent for potential future use with `paginateSubRows`.
172
+
173
+
### 2. Server-Side Row Selection
168
174
169
-
Currently sends `expanded` and `selectedRowIds` in every request, but no backend uses them. Either:
170
-
- Remove from requests until server-side selection/expansion is implemented
171
-
- Or implement server-side versions (see section 2)
175
+
~~This is complex work involving react-table hooks and row ID management.~~
172
176
173
-
### 2. Server-Side Row Selection and Expansion
177
+
**Done.** Cross-page row selection is fully implemented:
174
178
175
-
This is complex work involving react-table hooks and row ID management.
179
+
- Select-all queries the backend for all matching row IDs (via `selectAll` param) and stores them as explicit `selectedRowIds`
180
+
- Deselect-all only removes the filtered/searched rows, leaving other selections intact
181
+
- Per-row selections persist across page navigation, sort, and filter changes
182
+
-`isAllRowsSelected` checks against `serverRowCount` (not just current page rows)
183
+
-`toggleAllInProgressRef` guard prevents concurrent async calls from checkbox onChange+onClick bubbling
184
+
- All 3 backends (DuckDB, V8, df) support `selectAll`
185
+
-`defaultSelected` works correctly with `defaultSorted` via `__state` on pre-rendered pages
186
+
-`updateReactable(selected = ...)` works in backend modes (0-based indices match `__state.id`)
176
187
177
-
#### Current Behavior
178
-
- Selection and expansion fall back to client-side mode
179
-
- Select-all and expand-all only affect rows on the current page
180
-
- This matches ag-Grid's server-side model behavior
188
+
### 3. DuckDB-WASM Client Mode in Shiny
181
189
182
-
#### Implementation Approach
190
+
**Done.** DuckDB-WASM client mode (`backendDuckDB(mode = "client")`) works in Shiny apps:
183
191
184
-
**Option A: Document limitation (recommended for v1)**
185
-
- Document that select-all/expand-all only work for current page
192
+
- WASM base path detection: locator script (`duckdb-locator.js`) runs before the main bundle and uses `document.currentScript` with a `querySelector` fallback for Shiny (where scripts are dynamically inserted and `document.currentScript` is null)
193
+
- Runtime fallback in `Reactable.js``useEffect`: queries DOM for `script[src*="reactable-duckdb"]` to resolve WASM/worker paths
194
+
- Parquet sidecar files: same `querySelector` fallback in the Parquet locator script and a runtime URL resolution fallback in `useEffect`
195
+
- Both `format = "arrow"` and `format = "parquet"` work correctly
196
+
- Warning suppressed when user explicitly sets `mode = "client"` (only warns for auto-resolved client mode)
186
197
- This is acceptable behavior matching other table libraries
187
198
- Much simpler than full server-side implementation
0 commit comments