feat: quick hook to solve the delay problem in reposts
This commit is contained in:
parent
c161c3781a
commit
93205fb2db
|
|
@ -87,14 +87,16 @@ const Plug: FC<{
|
||||||
}> = ({ plug }) => {
|
}> = ({ plug }) => {
|
||||||
const { allIntegrations, integration } = useIntegration();
|
const { allIntegrations, integration } = useIntegration();
|
||||||
const { watch, setValue, control, register } = useSettings();
|
const { watch, setValue, control, register } = useSettings();
|
||||||
|
const [load, setLoad] = useState(false);
|
||||||
const val = watch(`plug--${plug.identifier}--integrations`);
|
const val = watch(`plug--${plug.identifier}--integrations`);
|
||||||
const active = watch(`plug--${plug.identifier}--active`);
|
const active = watch(`plug--${plug.identifier}--active`);
|
||||||
|
|
||||||
// const selectedIntegrationsValue = watch(
|
useEffect(() => {
|
||||||
// `plug.${plug.identifier}.integrations`
|
setTimeout(() => {
|
||||||
// );
|
setLoad(true);
|
||||||
//
|
}, 20);
|
||||||
// console.log(selectedIntegrationsValue);
|
}, []);
|
||||||
|
|
||||||
const [localValue, setLocalValue] = useState<Integrations[]>(
|
const [localValue, setLocalValue] = useState<Integrations[]>(
|
||||||
(val || []).map((p: any) => ({ ...p }))
|
(val || []).map((p: any) => ({ ...p }))
|
||||||
);
|
);
|
||||||
|
|
@ -109,6 +111,10 @@ const Plug: FC<{
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!load) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={plug.title}
|
key={plug.title}
|
||||||
|
|
|
||||||
|
|
@ -384,7 +384,9 @@ export const withProvider = function <T extends object>(
|
||||||
).json();
|
).json();
|
||||||
}, [props.identifier]);
|
}, [props.identifier]);
|
||||||
|
|
||||||
const { data } = useSWR(`internal-${props.identifier}`, getInternalPlugs);
|
const { data } = useSWR(`internal-${props.identifier}`, getInternalPlugs, {
|
||||||
|
revalidateOnReconnect: true,
|
||||||
|
});
|
||||||
|
|
||||||
// this is a trick to prevent the data from being deleted, yet we don't render the elements
|
// this is a trick to prevent the data from being deleted, yet we don't render the elements
|
||||||
if (!props.show) {
|
if (!props.show) {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ const eslintConfig = [
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/no-empty-object-type": "off",
|
"@typescript-eslint/no-empty-object-type": "off",
|
||||||
"@typescript-eslint/prefer-as-const": "off",
|
"@typescript-eslint/prefer-as-const": "off",
|
||||||
|
"@typescript-eslint/no-non-null-asserted-optional-chain": "off"
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue