Skip to content

Commit 6f371ed

Browse files
committed
fix: client hints plugin
1 parent 1eb195f commit 6f371ed

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

playground/app.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
</template>
1010

1111
<script setup>
12-
12+
const critical = useNuxtApp().$httpClientHints?.critical
13+
console.log(critical?.devicePixelRatio)
1314
</script>

src/runtime/plugins/types.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ declare module '#app' {
99
$detectBrowserAsync?: (hints?: UserAgentDataHints[]) => ReturnType<typeof asyncDetect>
1010
$detectOS?: () => ReturnType<typeof detectOS>
1111
$parseUserAgent?: () => ReturnType<typeof parseUserAgent>
12-
$httpClientHints?: DeepReadonly<UnwrapNestedRefs<HttpClientHintsState>>
12+
$httpClientHints?: DeepReadonly<HttpClientHintsState>
1313
}
1414
}
1515

1616
declare module 'vue' {
1717
interface ComponentCustomProperties {
18-
$httpClientHints?: DeepReadonly<UnwrapNestedRefs<HttpClientHintsState>>
18+
$httpClientHints?: DeepReadonly<HttpClientHintsState>
1919
}
2020
}
2121

src/utils/configuration.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export default defineNuxtPlugin({
172172
)
173173
return {
174174
provide: {
175-
httpClientHints: readonly(clientHints),
175+
httpClientHints: readonly(clientHints.value),
176176
}
177177
}
178178
}

0 commit comments

Comments
 (0)