Skip to content

feat(query): markdown import, button persistence, OR filters#8

Merged
kooksee merged 5 commits into
mainfrom
feat/markdown-import-query-button
Jun 24, 2026
Merged

feat(query): markdown import, button persistence, OR filters#8
kooksee merged 5 commits into
mainfrom
feat/markdown-import-query-button

Conversation

@kooksee

@kooksee kooksee commented Jun 24, 2026

Copy link
Copy Markdown

Summary

  • Import colanode-query and colanode-button fenced blocks from page markdown
  • Persist Page Button block script results (lastRun) across reloads; cap stored query rows
  • Configurable result columns on Query/Button blocks; Script Explorer shows query results as tables
  • Add OR support to query DSL and SQL/in-memory group filters

Test plan

  • packages/client and packages/ui tests pass
  • @colanode/ui build passes (group filter recursion fix)
  • Manual: import markdown with query/button fences
  • Manual: Page Button block shows table results and survives reload
  • Manual: Query Explorer DSL with OR matches database view filters

Made with Cursor

kooksee and others added 5 commits June 24, 2026 14:40
Parse fenced query/button blocks during page markdown import so export
round-trips restore databaseId, DSL, label, confirm, and script attrs.

Co-authored-by: Cursor <cursoragent@cursor.com>
Store lastRun on button block attrs so query tables survive reload.
Cap persisted query rows at 50 and clear cached results when the
database or script changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Introduce DatabaseFieldColumnsPicker for Query/Button blocks (up to 5
fields) and reuse ScriptResultView in Script Explorer for query output.

Co-authored-by: Cursor <cursoragent@cursor.com>
Parse WHERE clauses with AND/OR precedence into nested group filters
and execute OR/AND groups in buildFiltersQuery for database.query.

Co-authored-by: Cursor <cursoragent@cursor.com>
Nested OR/AND groups must call matchFilter, not matchFieldFilter, so
TypeScript and in-memory filtering stay aligned with SQL group filters.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kooksee kooksee merged commit 29a0693 into main Jun 24, 2026
1 check failed
@kooksee kooksee deleted the feat/markdown-import-query-button branch June 24, 2026 07:57

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for logical AND/OR operators with standard precedence in record queries, recursive group filters, configurable result columns for query and button blocks, and persistence of the last execution result (lastRun) for button blocks. It also adds markdown import/export support for these blocks. The review feedback highlights a critical issue in ButtonBlockPanel where deriving the last run state via useMemo prevents the UI from updating upon execution in read-only mode (when onChange is not provided). The reviewer suggests refactoring this to use a local state synchronized with the prop to ensure the execution results are immediately visible.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +81 to 84
const persistedLastRun = useMemo(
() => parseButtonBlockLastRun(lastRun),
[lastRun]
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using useMemo to derive persistedLastRun directly from the lastRun prop means that when the button is run in read-only mode (where onChange is not provided), the UI will not update to show the run results. Replacing this with a local state that is synchronized with the prop and updated on successful runs ensures the UI always displays the latest execution feedback.

Suggested change
const persistedLastRun = useMemo(
() => parseButtonBlockLastRun(lastRun),
[lastRun]
);
const [localLastRun, setLocalLastRun] = useState<ButtonBlockLastRun | null>(null);
useEffect(() => {
setLocalLastRun(parseButtonBlockLastRun(lastRun));
}, [lastRun]);

Comment on lines 191 to +192
onSuccess: (output) => {
setLastRun(output);
onChange?.({ lastRun: serializeButtonBlockLastRun(output) });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Update the onSuccess handler to update the local localLastRun state so that the run results are immediately visible even if onChange is not provided (e.g., in read-only views).

    onSuccess: (output) => {
      const serialized = serializeButtonBlockLastRun(output);
      setLocalLastRun(serialized);
      onChange?.({ lastRun: serialized });

Comment on lines +357 to 366
{persistedLastRun ? (
<div className="w-full space-y-2">
<ScriptResultView run={lastRun} fields={fields} />
<ScriptResultView
run={persistedLastRun}
fields={fields}
ranAt={persistedLastRun.ranAt}
selectedFieldIds={columns ?? undefined}
/>
</div>
) : null}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Use the new localLastRun state instead of persistedLastRun to render the script result view.

Suggested change
{persistedLastRun ? (
<div className="w-full space-y-2">
<ScriptResultView run={lastRun} fields={fields} />
<ScriptResultView
run={persistedLastRun}
fields={fields}
ranAt={persistedLastRun.ranAt}
selectedFieldIds={columns ?? undefined}
/>
</div>
) : null}
{localLastRun ? (
<div className="w-full space-y-2">
<ScriptResultView
run={localLastRun}
fields={fields}
ranAt={localLastRun.ranAt}
selectedFieldIds={columns ?? undefined}
/>
</div>
) : null}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant