Repository navigation
Mount Columns and Sort on the search page - #3432
elizabetdev wants to merge 10 commits into
Conversation
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
| const knownColumns = new Set(columns.map(column => column.name)); | ||
| // Field discovery is off for some teams, and `useAllFields` then returns | ||
| // [] rather than "still loading". Scalar columns are still known. | ||
| const keys = |
There was a problem hiding this comment.
🟠 major — Columns and Sort pickers never offer Timestamp or other DateTime fields, nor whole Map/JSON columns
getSqlSourceKeys/getSqlSourceColumnKeys (packages/app/src/components/AdhocDashboardFilter/useAdhocFilterOptions.ts:63-88) belong to the ad hoc filter. They drop every key where isAdhocComparableDataType (common-utils/src/filters.ts:963, !/\bDateTime/) is false, and they skip non-scalar top-level columns. So Timestamp/TimestampTime, the most common sort fields, never show up under 'Add sort' or 'Search columns', and neither does a whole column such as LogAttributes. Build the clause options from all columns plus map/JSON subpaths without the DateTime filter. Add a hook test with a DateTime64 column. The popover tests pass a hardcoded fieldOptions=['Body','Timestamp'], so they cannot catch this.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
| export const toRows = (keys: SortKey[] | null): SortRow[] | null => | ||
| keys?.map(key => newSortRow(key.id, key.desc)) ?? null; | ||
|
|
||
| /** A comma inside backticks cannot be split without breaking the identifier. */ |
There was a problem hiding this comment.
🔵 minor — hasCommaInsideBackticks re-implements the backtick scan that splitClauseList already does, and less accurately
splitClauseList (packages/app/src/utils.ts:1302) in this same PR splits around backtick-quoted names through replaceBacktickedIdentifiers (common-utils/src/core/utils.ts:462). That helper also skips string literals, which this scanner does not: position(Body, ',') DESCis wrongly treated as a custom sort. UsesplitClauseListinparseSortKeysinstead of bailing out tonull`, and delete this helper.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| isFieldMetadataDisabled || fields == null | ||
| ? getSqlSourceColumnKeys(columns) | ||
| : getSqlSourceKeys(fields, columns); | ||
| return Array.from( |
There was a problem hiding this comment.
🔵 minor — Keys are quoted twice; the second toQuotedClickHouseKeyExpression pass and its knownColumns set can't change anything
getSqlSourceKeys and getSqlSourceColumnKeys already run every key through toQuotedKeys → toQuotedClickHouseKeyExpression (useAdhocFilterOptions.ts:54-57), and that function leaves already-quoted input alone. Drop the extra .map(...) and the knownColumns set, and just dedupe and sort the keys.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
PR Review
4 finding(s): 🔴 0 critical · 🟠 2 major · 🔵 2 minor 4 posted as inline comment(s) on the changed lines. Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
E2E Test Results✅ All tests passed • 464 passed • 1 skipped • 1323s
Tests ran across 4 shards in parallel. |
Deep ReviewScope: PR #3432 — Intent: Move SELECT (Columns) and ORDER BY (Sort) editing off the search query form onto the results-table toolbar as popovers, shown only in ✅ No critical issues found. No P0/P1 defects were confirmed in the changed code. The two most significant prior-review items are addressed in this diff: the broken-sort-on-removed-alias bug ( 🟡 P2 -- recommended
🔵 P3 nitpicks (2)
Reviewers (1 completed of 10 dispatched): agent-native (no agent-native gaps — Testing gaps: No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
|
|
||
| // SELECT and ORDER BY shape the results table, so they sit on that table | ||
| // and stay hidden on Event Deltas and Event Patterns. | ||
| const resultsClauseEditors = |
There was a problem hiding this comment.
🔵 minor — New toolbar element on every render defeats the memo on DBSqlRowTable and RawLogTable
resultsClauseEditors is a new JSX element on every DBSearchPageContent render. It is passed as toolbarLeading through DBSqlRowTableWithSideBar into the memoized DBSqlRowTable (components/DBRowTable.tsx:2071) and RawLogTable. The page memoizes every other prop to that table (useCallback/useMemo), but now any page render re-renders the whole virtualized table, for example each keystroke in the time picker input. Wrap resultsClauseEditors in useMemo, with its inputs as dependencies.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| </> | ||
| ); | ||
| }; | ||
| const applySelect = useCallback( |
There was a problem hiding this comment.
🔵 minor — applySelect repeats toggleColumn's logic for pruning ORDER BY
applySelect repeats toggleColumn's steps (lines 1838-1872): set select, read orderBy with getValues, call orderByAfterRemovingSelectItem with defaultSearchConfig.orderBy, then setValue('orderBy'). Move this into one helper, for example pruneOrderByForRemovedItems(items), and call it from both places, so a change to the pruning rule cannot reach only one of them.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
🦋 Changeset detectedLatest commit: 977658f The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
[Medium impact] The changes affect the search page and its results-table workflow. Fix sort cleanup for removed aliases before merging.
|
SELECT and ORDER BY move off the query form onto the results table, and the where row wraps under the time controls on a narrow form. Co-authored-by: Cursor <cursoragent@cursor.com>
2096af9 to
b5442e5
Compare
| // SELECT and ORDER BY shape the results table, so they sit on that table | ||
| // and stay hidden on Event Deltas and Event Patterns. | ||
| const resultsClauseEditors = | ||
| analysisMode === 'results' ? ( |
There was a problem hiding this comment.
🟠 major — resultsClauseEditors is a new element on every page render, so the memoized results table re-renders on every keystroke
toolbarLeading={resultsClauseEditors} gets a fresh JSX element each time DBSearchPageContent renders. That breaks memo on both DBSqlRowTable and RawLogTable (DBRowTable.tsx:2074 and :391), whose other props from DBSqlRowTableWithSidebar are stable. The page re-renders on every WHERE keystroke because of useWatch({ name: 'where' }) at line 1631, so the virtualized table now re-renders on each one. Fix: wrap resultsClauseEditors in useMemo, keyed on analysisMode, inputSelect, inputOrderBy, clauseFieldOptions, knownColumns, applySelect, applyOrderBy, inputSourceTableConnection, inputSource and searchedTimeRange.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
| ); | ||
| }; | ||
| const applySelect = useCallback( | ||
| (select: string, removedItems: string[]) => { |
There was a problem hiding this comment.
🔵 minor — applySelect repeats the ORDER BY pruning that toggleColumn already does
Lines 2307-2316 copy the getValues('orderBy') → orderByAfterRemovingSelectItem(..., defaultSearchConfig.orderBy) → setValue('orderBy') sequence from toggleColumn at lines 1851-1860. Move it into one local helper, for example pruneOrderByForRemoved(items: string[]), and call it from both, so the two column-removal paths can't drift apart.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
Columns, Sort, and the table actions move onto another line instead of overlapping when the results panel is narrow. Co-authored-by: Cursor <cursoragent@cursor.com>
| </> | ||
| ); | ||
| }; | ||
| const applySelect = useCallback( |
There was a problem hiding this comment.
🔵 minor — applySelect copies the ORDER BY cleanup from toggleColumn
toggleColumn (lines 1851-1860) already does this: read getValues('orderBy'), apply orderByAfterRemovingSelectItem with defaultSearchConfig.orderBy, then setValue('orderBy'). Move it into one local helper, e.g. orderByWithout(items: string[]), and call it from both places so the two removal paths can't drift apart. The helper should also skip setValue when nothing changed, as toggleColumn does.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| </> | ||
| ); | ||
| }; | ||
| const applySelect = useCallback( |
There was a problem hiding this comment.
🔵 minor — No test covers the Columns and Sort apply logic on the search page
The PR says a removed column is also dropped from ORDER BY, but no test checks this. The DBSearchPage unit test mocks ColumnsPopover, SortPopover and useClauseFieldOptions with empty stubs. The changed e2e specs only read the button title. Add a test that removes a SELECT item that is also in ORDER BY through the Columns popover, then checks the submitted orderBy (or the search-sort-button title) after Apply.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
Typing in the popover reopens the completion list over Apply, so the saved-search click never lands. Co-authored-by: Cursor <cursoragent@cursor.com>
| ); | ||
| }; | ||
| const applySelect = useCallback( | ||
| (select: string, removedItems: string[]) => { |
There was a problem hiding this comment.
🔵 minor — applySelect duplicates toggleColumn's logic for pruning the sort and resubmitting
toggleColumn (DBSearchPage.tsx:1838) already sets select, runs orderByAfterRemovingSelectItem with defaultSearchConfig.orderBy, and calls onSubmit. That is the same as applySelect(newSelect, selected ? [selected] : []). Declare applySelect before toggleColumn and have toggleColumn call it, so the removal-to-sort rule lives in one place.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| // SELECT and ORDER BY shape the results table, so they sit on that table | ||
| // and stay hidden on Event Deltas and Event Patterns. | ||
| const resultsClauseEditors = | ||
| analysisMode === 'results' ? ( |
There was a problem hiding this comment.
🔵 minor — A new toolbarLeading element on every render cancels the memo on DBSqlRowTable and RawLogTable
Every other prop passed to DBSqlRowTableWithSideBar is wrapped in useMemo or useCallback (rowTableContext, onSortingChange, initialSortBy, …). resultsClauseEditors is fresh JSX on each render, so the memoized DBSqlRowTable and RawLogTable in DBRowTable.tsx now re-render the virtualized results table on every page render. Wrap resultsClauseEditors in useMemo, keyed on its inputs.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
An empty SELECT is shown as the source default. That default followed the URL source, so opening Columns after a source switch copied the previous source's column list. Co-authored-by: Cursor <cursoragent@cursor.com>
The raised footer also covered Fields autocomplete options that open inside the popover. Co-authored-by: Cursor <cursoragent@cursor.com>
|
|
||
| // SELECT and ORDER BY shape the results table, so they sit on that table | ||
| // and stay hidden on Event Deltas and Event Patterns. | ||
| const resultsClauseEditors = |
There was a problem hiding this comment.
🔵 minor — resultsClauseEditors is a new JSX element on every render, which defeats the memo on DBSqlRowTable and RawLogTable
DBSqlRowTable and RawLogTable are both wrapped in memo (components/DBRowTable.tsx:355 and :2078). Passing a fresh toolbarLeading element means every DBSearchPageContent render now re-renders the whole results table. Wrap the element in useMemo, keyed on analysisMode, inputSelect, inputOrderBy, defaultSelect, clauseFieldOptions, the two apply callbacks, the connection, the source and the date range. Or pass the popovers' props down and let the table render them.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| // The dropdown source can move before the URL source does. An empty SELECT | ||
| // is shown as this default, so it has to follow the dropdown, the same way | ||
| // the sort default follows useDefaultOrderBy(inputSource). | ||
| const savedSelect = |
There was a problem hiding this comment.
🔵 minor — defaultSelect copies defaultSearchConfig's saved-search check and creates a second SELECT default
savedSelect repeats the _savedSearch gating in defaultSearchConfig (line ~1218). The only difference is that it uses inputSourceObj, while defaultSearchConfig.select uses searchedSource. Header column toggles (displayedColumns/toggleColumn, ~1832) and the Columns popover can therefore start from different defaults while the dropdown and URL sources differ. Expose the gated saved search (or both defaults) from the one memo instead of rebuilding the logic here.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| ); | ||
| }; | ||
| const applySelect = useCallback( | ||
| (select: string, removedItems: string[]) => { |
There was a problem hiding this comment.
🔵 minor — applySelect repeats toggleColumn's rule for pruning ORDER BY
toggleColumn (~line 1851) already runs getValues('orderBy'), then orderByAfterRemovingSelectItem(..., defaultSearchConfig.orderBy), then setValue. applySelect now does the same thing in a loop. Move this into one helper, e.g. orderByAfterRemovingSelectItems(items, orderBy, default) in utils.ts next to orderByAfterRemovingSelectItem, and call it from both places so the rule can't drift.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| wrap="nowrap" | ||
| // The SQL completion list overflows the editor onto these buttons. | ||
| // Fields mode uses an in-popover Autocomplete, which must stay above them. | ||
| style={ |
There was a problem hiding this comment.
🔵 minor — The SQL-mode footer sits above the completion list and hides suggestions under Reset/Cancel/Apply
With zIndex: var(--mantine-z-index-max) on the footer, completion items that spill past the editor go underneath the footer's transparent row. Users see them overlap the button labels and cannot click them. Fix the list staying open after blur, which is the case the e2e applyClause works around. Or give the editor area room or a max height for the list, rather than layering the footer over it.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| ); | ||
| }; | ||
| const applySelect = useCallback( | ||
| (select: string, removedItems: string[]) => { |
There was a problem hiding this comment.
🔵 minor — No test covers the new Columns-apply wiring that drops removed columns from the sort
The PR description says removing a column drops it from the sort, but nothing tests the applySelect path. The e2e tests only set SELECT/ORDER BY through SQL, and DBSearchPage.directTrace.test mocks ColumnsPopover out. Add a test that removes an aliased column used in ORDER BY via Apply, and assert the resulting orderBy in the form or URL (including the fallback to the default sort).
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| orderBy = orderByAfterRemovingSelectItem( | ||
| item, | ||
| orderBy, | ||
| defaultSearchConfig.orderBy ?? '', | ||
| ); |
There was a problem hiding this comment.
Removed columns leave broken sorts
Select upper(Body) AS message, set Sort to message DESC, then remove that column through Columns and Apply. applySelect calls orderByAfterRemovingSelectItem, but that helper only matches "message", not message. The search then fails because the removed alias no longer exists. Match valid quoted and unquoted alias references when dropping sort fields.
| onRelativeSearch={onTimePickerRelativeSearch} | ||
| showLive={analysisMode === 'results'} | ||
| isLiveMode={isLive} | ||
| // Default to relative time mode if the user has made changes to interval and reloaded. |
There was a problem hiding this comment.
My only major feedback is this works, but the page has 5 rows of elements before the search results appear. We should in the future consider how we can save vertical space. it looks very off with the amount of empty space is in the source/save column.. i feel like we could compact/rearrange further.
There was a problem hiding this comment.
I think once we add Saved Views to the first row, along with Favorite and Share, the row will grow a little. Also in some scenarios we can have alerts.
However, table actions shouldn’t be placed in the last column. So even if we don’t add the columns and sorting controls, moving these elements out of the last column would create a new row anyway.
| } | ||
| : undefined | ||
| } | ||
| > |
There was a problem hiding this comment.
Feedback on this form: I got bit by this twice (I thought it was broken) so worth considering:
I added SeverityNumber but did NOT hit apply, it felt like clicking 'add' was saving. Then I clicked outside the popover and lost all my work. At the very least, we should confirm when closing without saving
| // The dropdown source can move before the URL source does. An empty SELECT | ||
| // is shown as this default, so it has to follow the dropdown, the same way | ||
| // the sort default follows useDefaultOrderBy(inputSource). | ||
| const savedSelect = |
There was a problem hiding this comment.
🔵 minor — Default SELECT is now computed in two places that have to be kept in sync by hand
savedSelect/sourceDefaultSelect repeat the saved-search gating and Log/Trace defaultTableSelectExpression lookup that defaultSearchConfig.select already does (~line 1215). The only difference is inputSourceObj versus searchedSource. Either parameterize defaultSearchConfig (expose an input-source variant next to the searched one) or pull the logic into one helper that takes the source, so a later change to how the default is picked can't update the table and the Columns popover differently.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| </> | ||
| ); | ||
| }; | ||
| const applySelect = useCallback( |
There was a problem hiding this comment.
🔵 minor — applySelect copies the ORDER BY pruning from toggleColumn
toggleColumn (~line 1856) already does getValues('orderBy') → orderByAfterRemovingSelectItem(item, orderBy, defaultSearchConfig.orderBy) → setValue. Move that into one helper, e.g. pruneOrderByForRemovedItems(items), and call it from both places, so a fix to the pruning rule reaches both the column-header remove and the Columns popover.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| {resultsClauseEditors} | ||
| </Box> | ||
| )} | ||
| <EmptyState |
There was a problem hiding this comment.
🔵 minor — Empty state keeps h="100%" beside the new toolbar, so the column overflows
In the !queryReady branch the Flex column is h="100%" and holds the Columns/Sort Box plus an EmptyState that is also h="100%". Together they are taller than the container by the toolbar's height, which pushes the empty state down or adds a scrollbar. Give EmptyState flex: 1 / mih={0} instead of h="100%".
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| wrap="nowrap" | ||
| // The SQL completion list overflows the editor onto these buttons. | ||
| // Fields mode uses an in-popover Autocomplete, which must stay above them. | ||
| style={ |
There was a problem hiding this comment.
🔵 minor — Raising the footer to max z-index hides SQL completion items behind it
In SQL mode the Reset/Cancel/Apply row is lifted above everything, and the comment says the completion list overflows onto that row. So any suggestions drawn over the footer are covered and can't be clicked: the row's transparent area still takes pointer events. Keep the completion tooltip on top instead (for example, give the editor room or keep the tooltip inside the popover), and stop the list being re-opened on blur rather than hiding it behind the buttons.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| } | ||
|
|
||
| /** The SELECT the table runs with; the Columns button carries it as its title. */ | ||
| async getSelectValue(): Promise<string> { |
There was a problem hiding this comment.
🔵 minor — getSelectValue reads the button title (form value or default), not the SELECT the table ran
The title is value || defaultValue, built from unsubmitted form state and the new defaultSelect fallback, so the doc comment "The SELECT the table runs with" is wrong. The rewritten saved-search and search specs would still pass if Apply stopped submitting, or if the table used a different default. Fix the comment, and in the key specs also assert on the select URL param or on the rendered table headers.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
Closing the Columns or Sort popover with an outside click, Escape, or the trigger button discarded an unapplied draft without warning. Ask first when Apply would change the stored clause. Cancel still discards immediately. The confirm dialog now renders above popovers, and the Columns hint says to add the column and then click Apply. Co-authored-by: Cursor <cursoragent@cursor.com>
| draft: string, | ||
| value: string, | ||
| defaultValue: string, | ||
| ) => storedClause(draft, value, defaultValue) !== value; |
There was a problem hiding this comment.
🟠 major — clauseDirty is true on open whenever the stored clause equals the default, so closing an unedited popover asks to discard
storedClause turns a draft that matches the default into ''. If value is a non-empty copy of defaultValue, '' does not equal value, so the untouched popover counts as dirty. This is the normal state for a saved search. The landing effect in DBSearchPage.tsx (~L1293) copies savedSearch.select and savedSearch.orderBy into the form, and defaultSelect/defaultSearchConfig.orderBy resolve to those same strings. So on any saved search with a custom SELECT or ORDER BY, opening Columns or Sort and clicking away pops 'Discard unsaved changes?'. Fix: compare the draft against the baseline, e.g. draft.trim() !== (value || defaultValue).trim(). Add a test where value === defaultValue.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
| // The dropdown source can move before the URL source does. An empty SELECT | ||
| // is shown as this default, so it has to follow the dropdown, the same way | ||
| // the sort default follows useDefaultOrderBy(inputSource). | ||
| const savedSelect = |
There was a problem hiding this comment.
🔵 minor — Second default-SELECT derivation duplicates defaultSearchConfig.select with a different source
savedSelect/sourceDefaultSelect repeat the saved-search guard in defaultSearchConfig (~L1215), but they use inputSourceObj where that code uses searchedSource. Before a source switch is submitted, the Columns button shows the new source's default while displayedColumns and the table still use the old one. Fix: keep one source of truth, e.g. expose both an input-based and a searched-based default from one memo, rather than restating the guard by hand.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| </> | ||
| ); | ||
| }; | ||
| const applySelect = useCallback( |
There was a problem hiding this comment.
🔵 minor — applySelect repeats the orderBy-pruning loop from toggleColumn
toggleColumn (~L1856) already calls orderByAfterRemovingSelectItem with defaultSearchConfig.orderBy on removed items, then setValue('orderBy') and onSubmit. Fix: move a shared pruneOrderBy(removed[]) helper next to these handlers and call it from both, so the two removal paths can't drift.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| mode === 'sql' | ||
| ? { | ||
| position: 'relative', | ||
| zIndex: 'var(--mantine-z-index-max)', |
There was a problem hiding this comment.
🔵 minor — Button row at --mantine-z-index-max hides SQL completion items behind Reset/Cancel/Apply
In SQL mode the CodeMirror completion list renders inside the dropdown and, as the comment says, overflows onto the button row. Raising the row to z-index max paints the buttons over any suggestions in that area, so the user can't see or click them. Fix: give the editor area enough room or limit the tooltip height. Another option is a CodeMirror tooltips({ parent: document.body }) config instead of covering the list.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
Removing a SELECT item such as upper(Body) AS message kept ORDER BY message DESC, because the sort was only matched against the double-quoted alias. The search then failed on an alias that no longer exists. Match the bare, double-quoted, and backtick-quoted forms. Co-authored-by: Cursor <cursoragent@cursor.com>
| draft: string, | ||
| value: string, | ||
| defaultValue: string, | ||
| ) => storedClause(draft, value, defaultValue) !== value; |
There was a problem hiding this comment.
🟠 major — clauseDirty is true for an untouched draft whenever the stored value equals the default text, so saved searches prompt 'Discard unsaved changes?' on a no-op close
When you open a saved search, the form's select is savedSearch.select and defaultSelect is that same string (DBSearchPage.tsx:2352). orderBy and defaultSearchConfig.orderBy match the same way. onOpen sets the draft to that value. storedClause matches the default and returns '', and '' !== value, so dirty is true. Clicking outside or toggling the button then asks for confirmation even though nothing changed. Fix: compare the effective clauses, e.g. draft.trim() !== (value || defaultValue).trim(), and add a test where value === defaultValue is non-empty.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
| ]) { | ||
| for (const [open, field] of [ | ||
| [() => searchPage.openSelectEditor(), searchPage.selectClauseField()], | ||
| [() => searchPage.openOrderByEditor(), searchPage.orderByClauseField()], |
There was a problem hiding this comment.
🟠 major — Multiline SELECT/ORDER BY e2e test now hits the discard confirm and cannot reach the Sort popover
In the first iteration, expectExpandsAndStaysExpanded types 'first line\nsecond line' into the Columns SQL draft, so the draft is dirty. openOrderByEditor then clicks the Sort button, which is an outside click for the Columns popover. That opens the new useConfirm modal at overlay z-index, above the popover, and it blocks the click on the Sort SQL tab. Click Columns Cancel (or reset the draft) before opening the next editor, or have openClauseSqlTab close any open clause popover through Cancel.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
| wrap="nowrap" | ||
| // The SQL completion list overflows the editor onto these buttons. | ||
| // Fields mode uses an in-popover Autocomplete, which must stay above them. | ||
| style={ |
There was a problem hiding this comment.
🔵 minor — SQL-mode button row is raised to z-index max, covering the CodeMirror completion list
The completion tooltip renders inside the popover and drops down over the Reset/Cancel/Apply row. The zIndex: var(--mantine-z-index-max) puts those buttons on top of the suggestions, so entries under them are hidden, and a click aimed at a suggestion hits Apply or Cancel instead. Leave the completion list on top (for example, give the editor/tooltip a higher stacking context or reserve space below the editor) rather than lifting the buttons over it.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| // The dropdown source can move before the URL source does. An empty SELECT | ||
| // is shown as this default, so it has to follow the dropdown, the same way | ||
| // the sort default follows useDefaultOrderBy(inputSource). | ||
| const savedSelect = |
There was a problem hiding this comment.
🔵 minor — defaultSelect re-implements defaultSearchConfig.select with a different source object
savedSelect/sourceDefaultSelect repeat the saved-search and source-kind logic in defaultSearchConfig (DBSearchPage.tsx:1215). That memo keys off searchedSource, while this copy keys off inputSourceObj, and displayedColumns (line ~1837) still uses defaultSearchConfig.select. The two now drift by hand. Put the inputSource-based default in one place (a field on defaultSearchConfig or a shared helper) and use it from both.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
Summary
Moves SELECT and ORDER BY off the query form. On a results search, Columns and Sort sit on the results table and edit those clauses. Event Deltas and Event Patterns do not show them. On a form narrower than 900px, the where clause and the time controls each take a full row, with the where clause first. Columns and Sort wrap with the table actions instead of overlapping them.
The editors landed in #3431.
Screenshots were not captured.
Screenshots or video
How to reproduce
Starting point:
yarn app:dev:localconnected to the demo server, or the Vercel preview. Open a log search and run it.On
main:On this branch:
How to test on Vercel preview
Preview routes: /search
Steps:
References