Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit f2beecd

Browse files
committed
fix: regression if ssrRef is used outside setup (in dev)
1 parent 60aaba0 commit f2beecd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/async.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const useAsync = <T>(
4444
!_ref.value ||
4545
(process.env.NODE_ENV === 'development' &&
4646
process.client &&
47-
window[globalNuxt].context.isHMR)
47+
window[globalNuxt]?.context.isHMR)
4848
) {
4949
const p = cb()
5050

src/ssr-ref.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const ssrRef = <T>(value: T | (() => T), key?: string): Ref<T> => {
5050
if (process.client) {
5151
if (
5252
process.env.NODE_ENV === 'development' &&
53-
window[globalNuxt].context.isHMR
53+
window[globalNuxt]?.context.isHMR
5454
) {
5555
return ref(getValue(value))
5656
}
@@ -128,7 +128,7 @@ export const shallowSsrRef = <T>(
128128
if (process.client) {
129129
if (
130130
process.env.NODE_ENV === 'development' &&
131-
window[globalNuxt].context.isHMR
131+
window[globalNuxt]?.context.isHMR
132132
) {
133133
return shallowRef(getValue(value))
134134
}

0 commit comments

Comments
 (0)