refactor(frontend): move detail view state initialization to server plugin
Remove top-level await from useAsyncData in detail views Remove manual state initialization blocks in components Introduce 03-detail-seo.server.ts to handle SEO and state
This commit is contained in:
@@ -34,7 +34,7 @@ const detailTabs = computed<TabOption[]>(() => [
|
||||
{ value: 'history', label: t('history.editHistory') }
|
||||
]);
|
||||
|
||||
const { data: initialHabitat } = await useAsyncData<HabitatDetail | null>(
|
||||
const { data: initialHabitat } = useAsyncData<HabitatDetail | null>(
|
||||
`habitat-detail:${activeHabitatRouteId() ?? 'none'}:${locale.value}`,
|
||||
async () => {
|
||||
const routeId = activeHabitatRouteId();
|
||||
@@ -52,11 +52,6 @@ const { data: initialHabitat } = await useAsyncData<HabitatDetail | null>(
|
||||
);
|
||||
|
||||
const initialHabitatLoaded = ref(false);
|
||||
if (initialHabitat.value) {
|
||||
habitat.value = initialHabitat.value;
|
||||
initialHabitatLoaded.value = true;
|
||||
}
|
||||
|
||||
const habitatSeo = computed(() =>
|
||||
habitat.value && route.meta.editorModal !== true
|
||||
? resolveSeo({
|
||||
|
||||
Reference in New Issue
Block a user