mirror of
https://github.com/ByteAtATime/raycast-linux.git
synced 2025-12-23 10:11:57 +00:00
feat: add suspense root in nav stack
This commit is contained in:
parent
1415011d55
commit
fc89593b48
2 changed files with 17 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import {
|
||||
createContext,
|
||||
Fragment,
|
||||
Suspense,
|
||||
useCallback,
|
||||
useContext,
|
||||
useEffect,
|
||||
|
|
@ -10,6 +11,7 @@ import {
|
|||
} from "react";
|
||||
import * as protocol from "../protocol";
|
||||
import { setNavigationPop } from "../index";
|
||||
import { List } from "./components";
|
||||
|
||||
declare module "react/jsx-runtime" {
|
||||
namespace JSX {
|
||||
|
|
@ -95,7 +97,11 @@ export const NavigationRoot: React.FC<{ children: ReactNode }> = (props) => {
|
|||
<NavigationContext.Provider value={navigation}>
|
||||
<flare-nav-stack>
|
||||
{routes.map((route) => (
|
||||
<Fragment key={route.id}>{route.component}</Fragment>
|
||||
<Fragment key={route.id}>
|
||||
<Suspense fallback={<List isLoading={true} />}>
|
||||
{route.component}
|
||||
</Suspense>
|
||||
</Fragment>
|
||||
))}
|
||||
</flare-nav-stack>
|
||||
</NavigationContext.Provider>
|
||||
|
|
|
|||
|
|
@ -199,6 +199,16 @@ const HostConfig: Reconciler.HostConfig<
|
|||
detachDeletedInstance() {},
|
||||
|
||||
getPublicInstance: (instance) => instance,
|
||||
|
||||
scheduleTimeout: setTimeout,
|
||||
cancelTimeout: clearTimeout,
|
||||
noTimeout: -1,
|
||||
|
||||
maySuspendCommit: () => false,
|
||||
preloadInstance: () => true,
|
||||
startSuspendingCommit: () => {},
|
||||
suspendInstance: () => {},
|
||||
waitForCommitToBeReady: () => null,
|
||||
};
|
||||
|
||||
const reconciler = Reconciler(HostConfig);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue