fix: harden widget review follow-ups

This commit is contained in:
Thomas Camlong committed 2026-08-02 16:10:16 +02:00
1 parent 7b7045202d
commit d5c3aebd26
10 files changed
+64 -26

No files matched your search

@@ -531,7 +531,10 @@ function CustomApiWidgetInner({
const widgetData = (data ?? {}) as Record<string, unknown>;
const dataType = widgetData.type as string | undefined;
const canTogglePolling = Boolean(data) && dataType !== "actionButton" && dataType !== "disabled";
const togglePolling = useCallback(() => setPollingPaused((value) => !value), []);
const togglePolling = useCallback(() => {
if (pollingPaused) void refetch();
setPollingPaused((value) => !value);
}, [pollingPaused, refetch]);
useEffect(() => {
if (!widgetStateRef) return;
@@ -607,10 +610,7 @@ function CustomApiWidgetInner({
aria-label={pollingLabel}
variant="subtle"
loading={isFetching}
onClick={() => {
if (pollingPaused) void refetch();
setPollingPaused((value) => !value);
}}
onClick={togglePolling}
>
{pollingPaused ? <IconPlayerPlay size={16} /> : <IconPlayerPause size={16} />}
</ActionIcon>