mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
3d09a69d58
* fix: eslint fixes --------- Co-authored-by: gurusainath <gurusainath007@gmail.com>
24 lines
776 B
TypeScript
24 lines
776 B
TypeScript
import React, { FC, createContext } from "react";
|
|
// mobx store
|
|
import { GanttStore } from "store/issue/issue_gantt_view.store";
|
|
|
|
let ganttViewStore = new GanttStore();
|
|
|
|
export const GanttStoreContext = createContext<GanttStore>(ganttViewStore);
|
|
|
|
const initializeStore = () => {
|
|
const newGanttViewStore = ganttViewStore ?? new GanttStore();
|
|
if (typeof window === "undefined") return newGanttViewStore;
|
|
if (!ganttViewStore) ganttViewStore = newGanttViewStore;
|
|
return newGanttViewStore;
|
|
};
|
|
|
|
type GanttStoreProviderProps = {
|
|
children: React.ReactNode;
|
|
};
|
|
|
|
export const GanttStoreProvider: FC<GanttStoreProviderProps> = ({ children }) => {
|
|
const store = initializeStore();
|
|
return <GanttStoreContext.Provider value={store}>{children}</GanttStoreContext.Provider>;
|
|
};
|