fix(editor): Handle localStorage being blocked/unavailable (#7348)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-10-27 15:51:20 +02:00
committed by GitHub
parent 739a4d4ecf
commit c05bc6728d
10 changed files with 69 additions and 45 deletions

View File

@@ -41,6 +41,7 @@ import { defineComponent } from 'vue';
import type { PropType } from 'vue';
import { mapStores } from 'pinia';
import { get } from 'lodash-es';
import { useStorage } from '@vueuse/core';
import type { INodeTypeDescription } from 'n8n-workflow';
import PanelDragButton from './PanelDragButton.vue';
@@ -345,9 +346,10 @@ export default defineComponent({
);
},
restorePositionData() {
const storedPanelWidthData = window.localStorage.getItem(
const storedPanelWidthData = useStorage(
`${LOCAL_STORAGE_MAIN_PANEL_RELATIVE_WIDTH}_${this.currentNodePaneType}`,
);
undefined,
).value;
if (storedPanelWidthData) {
const parsedWidth = parseFloat(storedPanelWidthData);