-
Notifications
You must be signed in to change notification settings - Fork 500
Resource Loading
We are using React Suspense for data loading. (It's part of Concurrent Mode)
export const ExtendedDDLViewerTabPanel: NavNodeTransformViewComponent = observer(function ExtendedDDLViewerTabPanel({
nodeId, folderId
}) {
const extendedDDLResource = useResource(ExtendedDDLViewerTabPanel, ExtendedDDLResource, nodeId);
const connectionDialectResource = useResource(ExtendedDDLViewerTabPanel, ConnectionDialectResource, connectionParam);
return styled(style)(
<wrapper>
<SQLCodeEditorLoader
value={extendedDDLResource.data}
dialect={connectionDialectResource.data}
readonly
/>
<MenuBar menu={menu} style={MENU_BAR_DEFAULT_STYLES} />
</wrapper>
);
});- We are loading resources with
useResource - when we access
extendedDDLResource.dataandconnectionDialectResource.datait triggerssuspenseAPI -
<Loader suspense>used inTabPanelwill display loading states
useResource will load data and track resource outdating. It's returning state with data and isLoading, isLoaded, isOutdated, tryGetData
tryGetData is equivalent to data but it will not trigger suspense API and can be used to track loading states manually
The closest Loader will display states of loading.
-
useResource(component, resource, key) component - can be React Component, React Functional Component, or React Hook
resource - resource instance or class
key - null (skip resource loading) or any other valid value -
useResource.data Returns
undefinedor loaded data (observable, suspense) -
useResource.tryGetData Returns
undefinedor loaded data (observable). Accessing this method will not trigger React Suspense. -
useResource.exception
: Error | Error[] | null -
useResource..isLoading() Returns
truewhen the resource is in the progress of loading data. -
useResource.isOutdated() Returns
truewhen the resource is outdated. -
useResource.isLoaded() Returns
truewhen data is loaded and can be accessed via.dataor.tryGetData. New data can be in the progress of loading or be outdated at the same time. -
useResource.isError() Returns
truewhen an error occurred when loading.
- Getting started
- Create connection
- Connection network options
- Supported databases
-
Drivers management
- Database authentication methods
- Database navigator
- Properties editor
- Data editor
- SQL editor
-
Entity relation diagrams
- Cloud services
-
AI Smart assistance
- Data transfer
- General user guide
- Administration
- Server configuration
-
Server security and access configuration
- Authentication methods
- Access management
- Proxy configuration
-
Secret management
- Logs
-
Query manager
- Workspace location
- Command line parameters
-
Session manager
- Deployment options
- CloudBeaver Editions
- FAQ
- Development