Skip to content

Commit 51579ef

Browse files
Changed onMounted to onBeforeMount to fix code loading a default lib before it can check the localstorage
1 parent 0d0eaae commit 51579ef

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/components/DemoPage.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
/* eslint-disable @typescript-eslint/no-unused-vars */
133133
import {
134134
inject,
135-
onMounted,
135+
onBeforeMount,
136136
provide,
137137
reactive,
138138
ref,
@@ -177,7 +177,7 @@ const selectedLibrary = ref(libraries.prism);
177177
const selectedTheme = ref('neon-bunny');
178178
179179
180-
onMounted(() => {
180+
onBeforeMount(() => {
181181
library.value = store.getLocalStorage() ?? store.setLocalStorage();
182182
changeLibrary(library.value);
183183
});

src/playground/configs/PlaygroundDemoPage.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
/* eslint-disable @typescript-eslint/no-unused-vars */
6666
import {
6767
inject,
68-
onMounted,
68+
onBeforeMount,
6969
provide,
7070
reactive,
7171
ref,
@@ -77,9 +77,6 @@ import PlaygroundPage from '@/playground/PlaygroundPage.vue';
7777
7878
const demoTestPage = ref(false);
7979
80-
const highlightJsLinks = inject('highlightJsLinks');
81-
const prismLinks = inject('prismLinks');
82-
8380
const store = useCoreStore();
8481
const library = ref('prism');
8582
const libraries = store.libraries;
@@ -88,12 +85,12 @@ const highlightThemes = store.highlightThemes;
8885
const neonBunnyThemes = store.neonBunnyThemes;
8986
const prismThemes = store.prismThemes;
9087
const selectOptions = ref(null);
91-
const selectedLibrary = ref(libraries.prism);
88+
const selectedLibrary = ref(libraries.prismjs);
9289
const selectedTheme = ref('neon-bunny');
9390
9491
95-
onMounted(() => {
96-
library.value = store.getLocalStorage() ?? store.setLocalStorage();
92+
onBeforeMount(() => {
93+
library.value = store.getLocalStorage() ?? store.setLocalStorage('prism');
9794
changeLibrary(library.value);
9895
});
9996

0 commit comments

Comments
 (0)