mvasigh / sveltekit-mdsvex-blog

A minimalistic blog template built with SvelteKit and MDsveX

Home Page:https://sveltekit-mdsvex-blog.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with post-to-post navigation

tigerxp opened this issue · comments

commented

If you'll make a link from one post to another - the page won't be updated, only it's metadata (frontmatter). That's because component definition in /src/routes/blog/[slug]/+page.svelte is not reactive and doesn't update when data.component is changed after navigation to another post while the page component itself isn't changed. I've fixed that by adding $: to the component definition, but probably there is a better way to do that:

$: component = data.component as unknown as C;

Thanks for catching this! I'm not a huge fan of how I am handling the post component compared to how the previous version of this template (pre-v1.0 SvelteKit) was doing it.

This seems like a fine solution for now though until I have bandwidth to investigate more. Would you like to PR the change?

commented

I could make a fork/branch/PR, but I think it will be much easier if you just add those 2 symbols to the code... I didn't check your previous version, unfortunately, and not a big fan 1.0 changes either..