feat(webui): Minor UI improvements:#1511
Conversation
WalkthroughAdded null-safe handling for query speed values and widened the QuerySpeed response type to permit nulls; refactored a state-update hook to read current UI state inside an effect; and made SearchResultsTable recompute layout when Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant UI as SearchResultsTable/UI
participant Presto as PrestoState (`sqlInterface`)
participant Effect as HeightCalcEffect
Note over Presto,Effect #ddeeff: When sqlInterface changes
Presto ->> UI: sqlInterface updated
UI ->> Effect: effect re-runs (depends on sqlInterface)
Effect ->> UI: recompute height/layout
sequenceDiagram
autonumber
participant Component as QuerySpeed component
participant Utils as fetchQuerySpeed
participant Const as SPEED_DEFAULT
Component ->> Utils: fetchQuerySpeed()
Utils -->> Component: { bytes: number|null, duration: number|null }
alt bytes or duration is null
Component ->> Const: return SPEED_DEFAULT
else both present
Component ->> Component: compute latency/speed
end
sequenceDiagram
autonumber
participant EffectFile as useUpdateStateWithMetadata effect
participant Store as useSearchStore
EffectFile ->> Store: useSearchStore.getState() (inside effect)
Store -->> EffectFile: current searchUiState
alt guard passes
EffectFile ->> EffectFile: proceed with metadata update
else guard fails
EffectFile ->> EffectFile: early return
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
components/webui/client/src/pages/SearchPage/SearchControls/QueryStatus/QuerySpeed/index.tsx(1 hunks)components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/index.tsx(3 hunks)components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}
⚙️ CodeRabbit configuration file
- Prefer
false == <expression>rather than!<expression>.
Files:
components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/index.tsxcomponents/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.tscomponents/webui/client/src/pages/SearchPage/SearchControls/QueryStatus/QuerySpeed/index.tsx
🪛 GitHub Actions: clp-lint
components/webui/client/src/pages/SearchPage/SearchControls/QueryStatus/QuerySpeed/index.tsx
[error] 42-42: Unnecessary optional chain on a non-nullish value. @typescript-eslint/no-unnecessary-condition
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: conventional-commits
- GitHub Check: package-image
🔇 Additional comments (2)
components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/index.tsx (1)
11-11: LGTM! Table height now recalculates when SQL interface changes.The import of
usePrestoSearchState, extraction ofsqlInterface, and addition to the effect dependency array correctly implements the stated objective. When the SQL interface switches, the effect will re-run, recalculating the table height based on current DOM dimensions.Also applies to: 25-25, 44-44
components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts (1)
41-45: LGTM! Reading state inside effect prevents stale closure issue.Reading
searchUiStateviauseSearchStore.getState()inside the effect ensures the current state is checked rather than a stale closure value from render time. This correctly prevents stale result metadata from updating query state, addressing the issue introduced by PR #1482 as noted in the PR description.
|
I adjusted the table to not grow as large should fix. My mac hides the scroll bar so didn't see. |
junhaoliao
left a comment
There was a problem hiding this comment.
deferring to @hoophalab 's review
- Prevent stale result metadata from updating state. - Recalculate result table height when switching sql interface. - Prevent calling toFixed on null value in query speed status. - Reduce size of results table to remove scroll bar.

Description
toFixedon null value in query speed status.PR #1482 made changes to result metadata that resulted in stale result metadata overwriting query state. Issue occurred during lint/review and could not retest since presto was down. This PR reverts this issue. Also I noticed the table height was not resizing properly when changing interfaces. This PR fixes as well. Lastly, I noticed an error showing up when calling a function in query speed. I believe the function is being called before the value is populated, so added a ternary to fix.
Checklist
breaking change.
Validation performed
Tested presto and CLP-s UI
Summary by CodeRabbit
Bug Fixes
UI
Refactor