fix(ssr): avoid hard-coded ssr checks in cjs builds
This commit is contained in:
@@ -21,7 +21,8 @@ import {
|
||||
currentInstance,
|
||||
ComponentInternalInstance,
|
||||
currentSuspense,
|
||||
Data
|
||||
Data,
|
||||
isInSSRComponentSetup
|
||||
} from './component'
|
||||
import {
|
||||
ErrorCodes,
|
||||
@@ -86,8 +87,8 @@ export function watch<T = any>(
|
||||
cbOrOptions?: WatchCallback<T> | WatchOptions,
|
||||
options?: WatchOptions
|
||||
): StopHandle {
|
||||
if (__SSR__ && !(options && options.flush === 'sync')) {
|
||||
// during SSR, non-sync watchers never fire.
|
||||
if (isInSSRComponentSetup && !(options && options.flush === 'sync')) {
|
||||
// component watchers during SSR are no-op
|
||||
return NOOP
|
||||
} else if (isFunction(cbOrOptions)) {
|
||||
// effect callback as 2nd argument - this is a source watcher
|
||||
|
||||
Reference in New Issue
Block a user