Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove useless call and correct fetch body #14

Merged
merged 1 commit into from
May 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/runtime/devtools/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export default function initServer (nuxt: Nuxt) {
routes: routesCount
})
}
return 'ok'
})
})
}
2 changes: 1 addition & 1 deletion src/runtime/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default defineNuxtPlugin((nuxt) => {
$fetch('/__hydration_ping', {
method: 'POST',
body: {
route: nuxt._route.matched[0].path
route: nuxt._route.matched[0]?.path ?? '/'
}
})
}
Expand Down
12 changes: 1 addition & 11 deletions src/runtime/view/TheContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,14 @@
<script setup lang="ts">
// @ts-ignore tsconfig
import { watch, ref } from 'vue'
import { useRoute, useState } from '#imports'
import { useState } from '#imports'

const route = useRoute()
const hydrationFailed = useState('hydration-failed', () => false)
const state = ref(false)

watch(hydrationFailed, () => {
if (hydrationFailed.value) {
state.value = true

// @ts-ignore tsconfig
$fetch('/_hydration_state', {
method: 'post',
body: {
route: route.fullPath,
hydrationFailed: true
}
})
}
})
</script>
Expand Down