Skip to content

Commit

Permalink
fix: hmr for nuxt content integration
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Nov 23, 2024
1 parent 20b8dd5 commit d8327a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/composables/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ onDevtoolsClientConnected(async (client) => {
client.devtools.extendClientRpc<ServerFunctions, ClientFunctions>('nuxt-og-image', {
refreshRouteData(path) {
// if path matches
if (devtoolsClient.value?.host.nuxt.vueApp.config?.globalProperties?.$route.matched[0].components?.default.__file.includes(path))
if (devtoolsClient.value?.host.nuxt.vueApp.config?.globalProperties?.$route.matched[0].components?.default.__file.includes(path) || path.endsWith('.md'))
refreshSources()
},
refresh() {
Expand Down
2 changes: 1 addition & 1 deletion src/build/devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function setupDevToolsUI(options: ModuleOptions, resolve: Resolver['resol
nuxt.hook('builder:watch', (e, path) => {
path = relative(nuxt.options.srcDir, resolve(nuxt.options.srcDir, path))
// needs to be for a page change
if ((e === 'change' || e.includes('link')) && path.startsWith('pages')) {
if ((e === 'change' || e.includes('link')) && (path.startsWith('pages') || path.startsWith('content'))) {
rpc.broadcast.refreshRouteData(path) // client needs to figure it if it's for the page we're on
.catch(() => {}) // ignore errors
}
Expand Down

0 comments on commit d8327a9

Please sign in to comment.