fix(editor): Handle localStorage being blocked/unavailable (#7348)
This commit is contained in:
committed by
GitHub
parent
739a4d4ecf
commit
c05bc6728d
@@ -1,3 +1,4 @@
|
||||
import { useStorage } from '@vueuse/core';
|
||||
import { LOCAL_STORAGE_MAPPING_IS_ONBOARDED, STORES } from '@/constants';
|
||||
import type {
|
||||
INodeUi,
|
||||
@@ -48,7 +49,7 @@ export const useNDVStore = defineStore(STORES.NDV, {
|
||||
canDrop: false,
|
||||
stickyPosition: null,
|
||||
},
|
||||
isMappingOnboarded: window.localStorage.getItem(LOCAL_STORAGE_MAPPING_IS_ONBOARDED) === 'true',
|
||||
isMappingOnboarded: useStorage(LOCAL_STORAGE_MAPPING_IS_ONBOARDED, undefined).value === 'true',
|
||||
}),
|
||||
getters: {
|
||||
activeNode(): INodeUi | null {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { Ref } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
import { useStorage } from '@vueuse/core';
|
||||
import { useUsersStore } from '@/stores/users.store';
|
||||
import { useRootStore } from '@/stores/n8nRoot.store';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
@@ -40,11 +41,11 @@ export const usePostHog = defineStore('posthog', () => {
|
||||
|
||||
if (!window.featureFlags) {
|
||||
// for testing
|
||||
const cachedOverrdies = localStorage.getItem(LOCAL_STORAGE_EXPERIMENT_OVERRIDES);
|
||||
if (cachedOverrdies) {
|
||||
const cachedOverrides = useStorage(LOCAL_STORAGE_EXPERIMENT_OVERRIDES, undefined).value;
|
||||
if (cachedOverrides) {
|
||||
try {
|
||||
console.log('Overriding feature flags', cachedOverrdies);
|
||||
overrides.value = JSON.parse(cachedOverrdies);
|
||||
console.log('Overriding feature flags', cachedOverrides);
|
||||
overrides.value = JSON.parse(cachedOverrides);
|
||||
} catch (e) {
|
||||
console.log('Could not override experiment', e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user