@appcorp/fusion-storybook 0.1.57 → 0.1.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Cache utilities for workspace data using generic cache system.
|
|
5
5
|
*/
|
|
6
|
-
import { getCachedSingleItem, getCachedSingleItemSync, invalidateCache, } from "@react-pakistan/util-functions";
|
|
6
|
+
import { getCachedSingleItem, getCachedSingleItemSync, invalidateCache, ONE_YEAR_IN_MS, } from "@react-pakistan/util-functions";
|
|
7
7
|
import { WORKSPACE_API_ROUTES } from "./constants";
|
|
8
8
|
import { LS_KEYS } from "../../constants";
|
|
9
9
|
// ============================================================================
|
|
@@ -21,7 +21,7 @@ export const getCachedWorkspace = (id) => {
|
|
|
21
21
|
return getCachedSingleItem(CACHE_CONFIG, { id });
|
|
22
22
|
};
|
|
23
23
|
export const getCachedWorkspaceSync = () => {
|
|
24
|
-
return getCachedSingleItemSync(LS_KEYS.WORKSPACE);
|
|
24
|
+
return getCachedSingleItemSync(LS_KEYS.WORKSPACE, ONE_YEAR_IN_MS);
|
|
25
25
|
};
|
|
26
26
|
export const invalidateWorkspaceCache = () => {
|
|
27
27
|
invalidateCache(LS_KEYS.WORKSPACE);
|
|
@@ -117,7 +117,7 @@ export const WorkspaceStateContextProvider = ({ children, }) => {
|
|
|
117
117
|
export const useWorkspaceModule = () => {
|
|
118
118
|
const { state, dispatch } = useWorkspaceContext();
|
|
119
119
|
const plans = useContext(PlansContext);
|
|
120
|
-
const workspace = getCachedWorkspaceSync();
|
|
120
|
+
const [workspace] = useState(() => getCachedWorkspaceSync());
|
|
121
121
|
const t = useTranslations("workspace");
|
|
122
122
|
// ============================================================================
|
|
123
123
|
// UTILITIES
|
|
@@ -282,7 +282,6 @@ export const useWorkspaceModule = () => {
|
|
|
282
282
|
// EFFECTS
|
|
283
283
|
// ============================================================================
|
|
284
284
|
useEffect(() => {
|
|
285
|
-
console.log("Workspace data loaded into context:", workspace);
|
|
286
285
|
if (workspace) {
|
|
287
286
|
dispatch({
|
|
288
287
|
type: WORKSPACE_ACTION_TYPES.SET_FORM_DATA,
|