Skip to content

Commit b2f227d

Browse files
committed
Move watchers to the bottom
1 parent b5380f3 commit b2f227d

1 file changed

Lines changed: 29 additions & 29 deletions

File tree

src/components/bblock/ExampleViewer.vue

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -301,28 +301,6 @@ const profilesMenuVisible = ref(false);
301301
const profileBBlocks = ref({});
302302
const refBBlock = ref(null);
303303
304-
watch(() => props.language, () => {
305-
showTransformDetails.value = false;
306-
transformOutputView.value = transformOutputIsHtml.value ? 'web' : 'code';
307-
profilesMenuVisible.value = false;
308-
});
309-
310-
watch(transformOutputGeoJson, (geoJson) => {
311-
if (geoJson && transformOutputView.value === 'code') {
312-
transformOutputView.value = 'map';
313-
}
314-
});
315-
316-
watch(() => props.language?.transformEntry?.profilesValidation, async (pv) => {
317-
if (!pv) return;
318-
const bblocks = await bblockService.getBBlocks(true);
319-
const result = {};
320-
for (const profileId of Object.keys(pv)) {
321-
result[profileId] = bblocks[profileId] || null;
322-
}
323-
profileBBlocks.value = result;
324-
}, { immediate: true });
325-
326304
const isMapView = computed(() => props.language?.id === 'map-view');
327305
const isWebView = computed(() => props.language?.id === 'web-view');
328306
const isTransformView = computed(() => props.language?.isTransform === true);
@@ -352,13 +330,6 @@ const currentSnippetRemote = computed(() => {
352330
return !!ref && /^https?:\/\//.test(ref) && !(props.sourceFilesUrl && ref.startsWith(props.sourceFilesUrl));
353331
});
354332
355-
watch(currentSnippet, async (snippet) => {
356-
refBBlock.value = null;
357-
if (snippet?.ref) {
358-
refBBlock.value = await bblockService.findResource(snippet.ref) ?? null;
359-
}
360-
}, { immediate: true });
361-
362333
const showContentSidebar = computed(() =>
363334
props.example.content?.trim() || currentSnippetRemote.value
364335
);
@@ -416,6 +387,35 @@ const profilesValidationPassed = computed(() => {
416387
return Object.values(profilesValidation.value).every(v => v.result);
417388
});
418389
390+
watch(() => props.language, () => {
391+
showTransformDetails.value = false;
392+
transformOutputView.value = transformOutputIsHtml.value ? 'web' : 'code';
393+
profilesMenuVisible.value = false;
394+
});
395+
396+
watch(transformOutputGeoJson, (geoJson) => {
397+
if (geoJson && transformOutputView.value === 'code') {
398+
transformOutputView.value = 'map';
399+
}
400+
});
401+
402+
watch(() => props.language?.transformEntry?.profilesValidation, async (pv) => {
403+
if (!pv) return;
404+
const bblocks = await bblockService.getBBlocks(true);
405+
const result = {};
406+
for (const profileId of Object.keys(pv)) {
407+
result[profileId] = bblocks[profileId] || null;
408+
}
409+
profileBBlocks.value = result;
410+
}, { immediate: true });
411+
412+
watch(currentSnippet, async (snippet) => {
413+
refBBlock.value = null;
414+
if (snippet?.ref) {
415+
refBBlock.value = await bblockService.findResource(snippet.ref) ?? null;
416+
}
417+
}, { immediate: true });
418+
419419
420420
function canOpenProfile(profileId) {
421421
const bblock = profileBBlocks.value[profileId];

0 commit comments

Comments
 (0)