Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
89a7e13 to
0ae766d
Compare
Code Review: feat(frontend): improve db uxOverviewThis PR merges the separate table-browser and SQL-shell views into a single unified actor database panel. It adds CodeMirror SQL editing with schema-aware autocomplete, named-property bindings for UPDATE statements, smart editable-table detection, and Bugs / CorrectnessRules of Hooks violation in function useManagedPool() {
if (__APP_TYPE__ !== 'cloud') return false; // <-- early return before hooks
const provider = useCloudNamespaceDataProvider();
const { data: hasManagedPool } = useSuspenseQuery(...);
return hasManagedPool;
}Hooks cannot be called conditionally. Even though function useManagedPool() {
const provider = useCloudNamespaceDataProvider();
const { data: hasManagedPool } = useSuspenseQuery(
provider.currentNamespaceHasManagedPoolQueryOptions(),
);
return __APP_TYPE__ === 'cloud' && hasManagedPool;
}Silent error swallowing in mutateAsync(request)
.then((r) => setResult(r))
.catch(() => {}); // errors silently discardedIf the initial table SELECT fails, the user sees nothing. At minimum set
The function returns Unused
Code Quality
Duplicated refresh logic in
Positive Highlights
SummaryTwo blocking items before the next merge: the Rules of Hooks violation in |
Code Review: feat(frontend): improve db uxOverviewThis PR merges the separate Tables browser and Query SQL shell into a unified database view, adds a CodeMirror SQL editor with schema-aware autocomplete, and carries over inline cell-editing to the combined view. It also adds AbortSignal.timeout to several fetch calls and switches cell-update SQL from positional bindings to named properties. The direction is good. However, there are several bugs and quality issues to address before merging. Bugs1. React Rules of Hooks violation in useManagedPool (critical) In actors-actor-details.tsx, the new useManagedPool helper calls hooks after a conditional return. React requires hooks to always be called in the same order — returning early before hook calls will throw a “Rendered more hooks than during the previous render” error at runtime. Restructure so hooks are called unconditionally, then apply the condition to the return value. 2. showOnlyFatal prop leaks to the DOM and has no effect In actor-status-indicator.tsx, showOnlyFatal is added to the interface but is not destructured separately from ...props, so it gets spread onto the underlying span element as an unknown DOM attribute. React will warn about this. The prop also has no effect since it is never read. Destructure it and implement the filtering logic, or remove it. 3. pendingRunConfirm dialog fires on every keystroke In handleSqlChange, setPendingRunConfirm(true) is called whenever stagedEditCount > 0, which means the confirmation banner appears on every keystroke as the user types SQL — not only when they explicitly click Run (where this flag is also set). Only set pendingRunConfirm inside handleRun. Code Quality4. sql_text uses snake_case This is the only snake_case local variable in the component. Rename to sqlText to match the camelCase convention used everywhere else. 5. page state is dead code The page state is initialized and reset in selectTable, but the pagination UI (prev/next buttons, page counter) was removed in this PR. The state is never consumed in any rendered output. Remove it and PAGE_SIZE if pagination was intentionally dropped, or restore the pagination controls if they were accidentally omitted. 6. selectTable calls buildSelectSql twice and silently swallows errors buildSelectSql(tableName) is called once to set state and again to build the request object. Extract to a local variable to avoid the duplicate call. The empty .catch(() => {}) means the user gets no feedback if the auto-selected table query fails — at minimum propagate into sqlError or call setResult(null) in the catch. 7. applyEdits duplicates the post-run refresh logic from executeRun After committing edits, applyEdits manually calls mutateAsync again and re-runs detectEditableTable, duplicating the logic already in executeRun. Consider extracting a shared refresh helper or calling executeRun directly after the edits are applied. 8. detectEditableTable SQL parsing is fragile The FROM regex will not handle CTEs (WITH cte AS (...) SELECT ?... FROM cte), schema-qualified names (main.users), subqueries in FROM, or bracket-quoted identifiers ([table name]). This is probably acceptable for de common case, but the known limitations should be noted in a comment so future readers understand when editability will silently not be detected. 9. Cmd+Enter hint is platform-specific The keymap uses Mod-Enter (which maps to Ctrl on Windows/Linux), but the hint text hardcodes "Cmd+Enter". Change the label to "Ctrl/Cmd+Enter" or detect the platform at runtime. 10. Shared mutation state between auto-select and user-run queries Both selectTable and executeRun share the same useMutation instance. When a table is auto-selected on mount, isPending becomes true and blocks the Run button. If the auto-select errors, sqlError appears in the query panel even though the user never initiated a run. Consider using a separate mutation or plain fetch for the auto-select path. Minor
|
Preview packages published to npmInstall with: npm install rivetkit@pr-4683All packages published as Engine binary is shipped via Docker images: docker pull rivetdev/engine:slim-9557af4
docker pull rivetdev/engine:full-9557af4Individual packagesnpm install rivetkit@pr-4683
npm install @rivetkit/react@pr-4683
npm install @rivetkit/rivetkit-native@pr-4683
npm install @rivetkit/sqlite-wasm@pr-4683
npm install @rivetkit/workflow-engine@pr-4683 |

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: