fix: refine widget modernization

This commit is contained in:
Thomas Camlong committed 2026-08-01 21:45:01 +02:00
1 parent d421046d15
commit b28beec2c6
50 files changed
+292 -386

No files matched your search

+1 -10
View File
@@ -484,8 +484,7 @@ function CustomApiWidgetInner({
const tCustomWidget = useScopedI18n("customWidget");
const safeInterval = Number.isFinite(refreshInterval) ? refreshInterval : 30;
const intervalMs = Math.max(1000, safeInterval * 1000);
const persistedState = widgetStateRef?.current?.customApi as { pollingPaused?: boolean } | undefined;
const [pollingPaused, setPollingPaused] = useState(persistedState?.pollingPaused === true);
const [pollingPaused, setPollingPaused] = useState(false);
const { data, isLoading, error, refetch, isFetching } = clientApi.widget.customApi.getData.useQuery(
{ definitionId },
{
@@ -506,14 +505,6 @@ function CustomApiWidgetInner({
const canTogglePolling = Boolean(data) && dataType !== "actionButton" && dataType !== "disabled";
const togglePolling = useCallback(() => setPollingPaused((value) => !value), []);
useEffect(() => {
if (!widgetStateRef) return;
widgetStateRef.current = {
...widgetStateRef.current,
customApi: { pollingPaused },
};
}, [pollingPaused, widgetStateRef]);
useEffect(() => {
if (!widgetStateRef) return;
if (canTogglePolling) {
-1
View File
@@ -6,7 +6,6 @@ import { optionsBuilder } from "../options";
export const { definition, componentLoader } = createWidgetDefinition("customApi", {
icon: IconApi,
queryKey: [["widget", "customApi"]],
contextActions({ options, widgetStateRef }) {
return [
{