mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: fetch issue view context props error (#205)
* fix: build errors in docs * fix: fetching issue view props error
This commit is contained in:
parent
46973149bf
commit
7ca1aef2ad
@ -1,4 +1,4 @@
|
|||||||
import { createContext, useCallback, useReducer } from "react";
|
import { createContext, useCallback, useEffect, useReducer } from "react";
|
||||||
|
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
@ -24,6 +24,7 @@ type IssueViewProps = {
|
|||||||
|
|
||||||
type ReducerActionType = {
|
type ReducerActionType = {
|
||||||
type:
|
type:
|
||||||
|
| "REHYDRATE_THEME"
|
||||||
| "SET_ISSUE_VIEW"
|
| "SET_ISSUE_VIEW"
|
||||||
| "SET_ORDER_BY_PROPERTY"
|
| "SET_ORDER_BY_PROPERTY"
|
||||||
| "SET_FILTER_ISSUES"
|
| "SET_FILTER_ISSUES"
|
||||||
@ -65,6 +66,12 @@ export const reducer: ReducerFunctionType = (state, action) => {
|
|||||||
const { type, payload } = action;
|
const { type, payload } = action;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case "REHYDRATE_THEME": {
|
||||||
|
let collapsed: any = localStorage.getItem("collapsed");
|
||||||
|
collapsed = collapsed ? JSON.parse(collapsed) : false;
|
||||||
|
return { ...initialState, ...payload, collapsed };
|
||||||
|
}
|
||||||
|
|
||||||
case "SET_ISSUE_VIEW": {
|
case "SET_ISSUE_VIEW": {
|
||||||
const newState = {
|
const newState = {
|
||||||
...state,
|
...state,
|
||||||
@ -260,6 +267,13 @@ export const IssueViewContextProvider: React.FC<{ children: React.ReactNode }> =
|
|||||||
saveDataToServer(workspaceSlug as string, projectId as string, myViewProps?.default_props);
|
saveDataToServer(workspaceSlug as string, projectId as string, myViewProps?.default_props);
|
||||||
}, [projectId, workspaceSlug, myViewProps]);
|
}, [projectId, workspaceSlug, myViewProps]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
dispatch({
|
||||||
|
type: "REHYDRATE_THEME",
|
||||||
|
payload: myViewProps?.view_props,
|
||||||
|
});
|
||||||
|
}, [myViewProps]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<issueViewContext.Provider
|
<issueViewContext.Provider
|
||||||
value={{
|
value={{
|
||||||
|
Loading…
Reference in New Issue
Block a user