mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-05-01 15:46:40 +07:00
added nextjs flow preloading
This commit is contained in:
parent
6f161d12ff
commit
1f296e9ed8
6 changed files with 90 additions and 66 deletions
src/utils/context
|
@ -1,30 +0,0 @@
|
|||
import React, { createContext, FC, useContext } from 'react';
|
||||
|
||||
import { FlowDisplay, IFlowNode, INode } from '~/types';
|
||||
|
||||
export interface FlowContextProps {
|
||||
updates: IFlowNode[];
|
||||
recent: IFlowNode[];
|
||||
heroes: IFlowNode[];
|
||||
nodes: IFlowNode[];
|
||||
isSyncing: boolean;
|
||||
loadMore: () => Promise<unknown>;
|
||||
onChangeCellView: (id: INode['id'], flow: FlowDisplay) => void;
|
||||
}
|
||||
|
||||
export const FlowContext = createContext<FlowContextProps>({
|
||||
updates: [],
|
||||
recent: [],
|
||||
heroes: [],
|
||||
nodes: [],
|
||||
isSyncing: false,
|
||||
loadMore: async () => {},
|
||||
|
||||
onChangeCellView: () => {},
|
||||
});
|
||||
|
||||
export const FlowContextProvider: FC<FlowContextProps> = ({ children, ...contextValue }) => {
|
||||
return <FlowContext.Provider value={contextValue}>{children}</FlowContext.Provider>;
|
||||
};
|
||||
|
||||
export const useFlowContext = () => useContext(FlowContext);
|
Loading…
Add table
Add a link
Reference in a new issue