fix(widgets): race conditions in useLiveStats and stale value in integration select

- Add generation guard to prevent late SSE events from writing stale
  data after systemId/integration changes
- Sort integrationIds for stable key (avoids unnecessary resubscribes)
- Include integrationKey and systemId in flush interval deps
- Preserve current form value in WidgetIntegrationSelectInput when it's
  missing from loaded options (matches WidgetDynamicSelectInput pattern)
This commit is contained in:
Thomas Camlong committed 2026-06-16 17:59:41 +02:00
1 parent 065b78fa3e
commit 5078c300f8
2 files changed
+23 -10

No files matched your search

@@ -22,6 +22,11 @@ export const WidgetIntegrationSelectInput = ({
const integrationIds = form.values.integrationIds as string[];
const { data: selectData = [], isPending, isError } = options.useOptions(integrationIds);
const currentValue = form.getInputProps(`options.${property}`).value as string;
const data =
currentValue && !selectData.some((opt) => opt.value === currentValue)
? [...selectData, { value: currentValue, label: currentValue }]
: selectData;
if (integrationIds.length === 0) {
return (
@@ -39,7 +44,7 @@ export const WidgetIntegrationSelectInput = ({
clearable={options.clearable}
searchable={options.searchable}
nothingFoundMessage={t("noResults")}
data={selectData}
data={data}
disabled={isError}
error={(isError && t("loadError")) || undefined}
{...form.getInputProps(`options.${property}`)}