mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
fix: chartpage querying too on every keystroke after initial query (#870)
This commit is contained in:
parent
e27c24a13f
commit
d176b54b4e
2 changed files with 15 additions and 3 deletions
5
.changeset/dirty-carrots-peel.md
Normal file
5
.changeset/dirty-carrots-peel.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@hyperdx/app": patch
|
||||
---
|
||||
|
||||
fix: chartpage querying too on every keystroke after initial query
|
||||
|
|
@ -406,8 +406,8 @@ export default function EditTimeChartForm({
|
|||
setChartConfig(form);
|
||||
if (tableSource != null) {
|
||||
const isSelectEmpty = !form.select || form.select.length === 0; // select is string or array
|
||||
setQueriedConfig({
|
||||
...structuredClone(form),
|
||||
const newConfig = {
|
||||
...form,
|
||||
from: tableSource.from,
|
||||
timestampValueExpression: tableSource.timestampValueExpression,
|
||||
dateRange,
|
||||
|
|
@ -417,7 +417,14 @@ export default function EditTimeChartForm({
|
|||
select: isSelectEmpty
|
||||
? tableSource.defaultTableSelectExpression || ''
|
||||
: form.select,
|
||||
});
|
||||
};
|
||||
setQueriedConfig(
|
||||
// WARNING: DON'T JUST ASSIGN OBJECTS OR DO SPREAD OPERATOR STUFF WHEN
|
||||
// YOUR STATE IS AN OBJECT. YOU'RE COPYING BY REFERENCE WHICH MIGHT
|
||||
// ACCIDENTALLY CAUSE A useQuery SOMEWHERE TO FIRE A REQUEST EVERYTIME
|
||||
// AN INPUT CHANGES. USE structuredClone TO PERFORM A DEEP COPY INSTEAD
|
||||
structuredClone(newConfig),
|
||||
);
|
||||
}
|
||||
})();
|
||||
}, [handleSubmit, setChartConfig, setQueriedConfig, tableSource, dateRange]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue