mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(editor): Polyfill crypto.randomUUID (#12052)
This commit is contained in:
parent
7a0a9e4a7b
commit
3ca85217de
|
@ -1,6 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, watch, onMounted, onBeforeUnmount, nextTick } from 'vue';
|
import { ref, computed, watch, onMounted, onBeforeUnmount, nextTick } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
import { v4 as uuid } from 'uuid';
|
||||||
import LoadingView from '@/views/LoadingView.vue';
|
import LoadingView from '@/views/LoadingView.vue';
|
||||||
import BannerStack from '@/components/banners/BannerStack.vue';
|
import BannerStack from '@/components/banners/BannerStack.vue';
|
||||||
import AskAssistantChat from '@/components/AskAssistant/AskAssistantChat.vue';
|
import AskAssistantChat from '@/components/AskAssistant/AskAssistantChat.vue';
|
||||||
|
@ -17,6 +18,11 @@ import { useSettingsStore } from '@/stores/settings.store';
|
||||||
import { useHistoryHelper } from '@/composables/useHistoryHelper';
|
import { useHistoryHelper } from '@/composables/useHistoryHelper';
|
||||||
import { useStyles } from './composables/useStyles';
|
import { useStyles } from './composables/useStyles';
|
||||||
|
|
||||||
|
// Polyfill crypto.randomUUID
|
||||||
|
if (!('randomUUID' in crypto)) {
|
||||||
|
Object.defineProperty(crypto, 'randomUUID', { value: uuid });
|
||||||
|
}
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const rootStore = useRootStore();
|
const rootStore = useRootStore();
|
||||||
const assistantStore = useAssistantStore();
|
const assistantStore = useAssistantStore();
|
||||||
|
|
|
@ -9,7 +9,7 @@ import type { IExecutionFlattedResponse, IExecutionResponse, IRestApiContext } f
|
||||||
|
|
||||||
const getBrowserId = () => {
|
const getBrowserId = () => {
|
||||||
let browserId = localStorage.getItem(BROWSER_ID_STORAGE_KEY);
|
let browserId = localStorage.getItem(BROWSER_ID_STORAGE_KEY);
|
||||||
if (!browserId && 'randomUUID' in crypto) {
|
if (!browserId) {
|
||||||
browserId = crypto.randomUUID();
|
browserId = crypto.randomUUID();
|
||||||
localStorage.setItem(BROWSER_ID_STORAGE_KEY, browserId);
|
localStorage.setItem(BROWSER_ID_STORAGE_KEY, browserId);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue