mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
fix: memoize inputs to fix performance issues (#1291)
Fixes HDX-2644 Fixes #1288
This commit is contained in:
parent
bb3539dd5d
commit
93edb6f84f
3 changed files with 24 additions and 15 deletions
5
.changeset/angry-scissors-flow.md
Normal file
5
.changeset/angry-scissors-flow.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@hyperdx/app": patch
|
||||
---
|
||||
|
||||
fix: memoize inputs to fix text input performance
|
||||
|
|
@ -1208,9 +1208,12 @@ function DBSearchPage() {
|
|||
);
|
||||
// Parse the orderBy string into a SortingState. We need the string
|
||||
// version in other places so we keep this parser separate.
|
||||
const orderByConfig = parseAsSortingStateString.parse(
|
||||
searchedConfig.orderBy ?? '',
|
||||
);
|
||||
const initialSortBy = useMemo(() => {
|
||||
const orderBy = parseAsSortingStateString.parse(
|
||||
searchedConfig.orderBy ?? '',
|
||||
);
|
||||
return orderBy ? [orderBy] : [];
|
||||
}, [searchedConfig.orderBy]);
|
||||
|
||||
const handleTimeRangeSelect = useCallback(
|
||||
(d1: Date, d2: Date) => {
|
||||
|
|
@ -1824,7 +1827,7 @@ function DBSearchPage() {
|
|||
denoiseResults={denoiseResults}
|
||||
collapseAllRows={collapseAllRows}
|
||||
onSortingChange={onSortingChange}
|
||||
initialSortBy={orderByConfig ? [orderByConfig] : []}
|
||||
initialSortBy={initialSortBy}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -74,6 +74,17 @@ export default function DBSqlRowTableWithSideBar({
|
|||
setRowId(null);
|
||||
setRowSource(null);
|
||||
}, [setRowId, setRowSource]);
|
||||
const renderRowDetails = useCallback(
|
||||
(r: { [key: string]: unknown }) => {
|
||||
if (!sourceData) {
|
||||
return <div className="p-3 text-muted">Loading...</div>;
|
||||
}
|
||||
return (
|
||||
<RowOverviewPanelWrapper source={sourceData} rowId={r.id as string} />
|
||||
);
|
||||
},
|
||||
[sourceData],
|
||||
);
|
||||
|
||||
return (
|
||||
<RowSidePanelContext.Provider value={context ?? {}}>
|
||||
|
|
@ -97,17 +108,7 @@ export default function DBSqlRowTableWithSideBar({
|
|||
onSortingChange={onSortingChange}
|
||||
denoiseResults={denoiseResults}
|
||||
initialSortBy={initialSortBy}
|
||||
renderRowDetails={r => {
|
||||
if (!sourceData) {
|
||||
return <div className="p-3 text-muted">Loading...</div>;
|
||||
}
|
||||
return (
|
||||
<RowOverviewPanelWrapper
|
||||
source={sourceData}
|
||||
rowId={r.id as string}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
renderRowDetails={renderRowDetails}
|
||||
onScroll={onScroll}
|
||||
onError={onError}
|
||||
onExpandedRowsChange={onExpandedRowsChange}
|
||||
|
|
|
|||
Loading…
Reference in a new issue