mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-10-12 23:37:00 +08:00
CB-3889 fix: useResource sync (#1957)
Co-authored-by: EvgeniaBzzz <139753579+EvgeniaBzzz@users.noreply.github.com>
This commit is contained in:
@@ -462,12 +462,26 @@ export function useResource<
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
refObj.use(key);
|
||||
if (result.canLoad && !result.isError()) {
|
||||
result.load();
|
||||
}
|
||||
}, [result.canLoad]);
|
||||
useEffect(
|
||||
() =>
|
||||
reaction(
|
||||
() => ({
|
||||
canLoad: result.canLoad,
|
||||
loadKey: propertiesRef.key,
|
||||
}),
|
||||
({ canLoad, loadKey }) => {
|
||||
refObj.use(loadKey);
|
||||
if (canLoad && !result.isError()) {
|
||||
result.load();
|
||||
}
|
||||
},
|
||||
{
|
||||
fireImmediately: true,
|
||||
delay: 100,
|
||||
},
|
||||
),
|
||||
[],
|
||||
);
|
||||
|
||||
if (actions?.forceSuspense) {
|
||||
result.data;
|
||||
|
||||
Reference in New Issue
Block a user