UNPKG

@atlaskit/page-layout

Version:

A collection of components which let you compose an application's page layout.

14 lines 510 B
import { PAGE_LAYOUT_LS_KEY } from './constants'; import safeLocalStorage from './safe-local-storage'; export const mergeGridStateIntoStorage = (key, value) => { const storageValue = JSON.parse(safeLocalStorage().getItem(PAGE_LAYOUT_LS_KEY) || '{}'); if (value !== null && typeof value === 'object') { storageValue[key] = { ...storageValue[key], ...value }; } else { storageValue[key] = value; } safeLocalStorage().setItem(PAGE_LAYOUT_LS_KEY, JSON.stringify(storageValue)); };