debug: with reset data if slug is changes in slug/tab articalpage
This commit is contained in:
parent
91d8fdf746
commit
dc2b6a5ab1
|
@ -1,6 +1,6 @@
|
||||||
import { RouteDefinition, RouteSectionProps, createAsync, useLocation } from '@solidjs/router'
|
import { RouteDefinition, RouteSectionProps, createAsync, useLocation } from '@solidjs/router'
|
||||||
import { HttpStatusCode } from '@solidjs/start'
|
import { HttpStatusCode } from '@solidjs/start'
|
||||||
import { ErrorBoundary, Show, Suspense, createEffect, on, onMount } from 'solid-js'
|
import { ErrorBoundary, Show, Suspense, onMount } from 'solid-js'
|
||||||
import { FourOuFourView } from '~/components/Views/FourOuFour'
|
import { FourOuFourView } from '~/components/Views/FourOuFour'
|
||||||
import { Loading } from '~/components/_shared/Loading'
|
import { Loading } from '~/components/_shared/Loading'
|
||||||
import { gaIdentity } from '~/config'
|
import { gaIdentity } from '~/config'
|
||||||
|
@ -29,6 +29,9 @@ export const route: RouteDefinition = {
|
||||||
console.debug('route.load called with params:', params)
|
console.debug('route.load called with params:', params)
|
||||||
const article = await fetchShout(params.slug)
|
const article = await fetchShout(params.slug)
|
||||||
console.debug('route.load fetched article:', article)
|
console.debug('route.load fetched article:', article)
|
||||||
|
if (!article) {
|
||||||
|
console.warn('No article fetched for the given slug:', params.slug);
|
||||||
|
}
|
||||||
return { article }
|
return { article }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,22 +99,6 @@ export default function ArticlePage(props: RouteSectionProps<SlugPageProps>) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
createEffect(
|
|
||||||
on(
|
|
||||||
data,
|
|
||||||
(a?: Shout) => {
|
|
||||||
console.debug('createEffect triggered with data:', a)
|
|
||||||
if (!a?.id) return
|
|
||||||
window?.gtag?.('event', 'page_view', {
|
|
||||||
page_title: a.title,
|
|
||||||
page_location: window?.location.href || '',
|
|
||||||
page_path: loc.pathname
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{ defer: true }
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ErrorBoundary fallback={() => {
|
<ErrorBoundary fallback={() => {
|
||||||
console.error('Rendering 500 error page')
|
console.error('Rendering 500 error page')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user