From 048fec19797234408dffaab3f1ddd2e2e8ab85e6 Mon Sep 17 00:00:00 2001 From: Greg Nagy Date: Mon, 14 Jul 2025 17:12:18 +0400 Subject: [PATCH] feat: throw if there is no options used in server context --- src/common/utils.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common/utils.ts b/src/common/utils.ts index 93a0536..5ca6a85 100644 --- a/src/common/utils.ts +++ b/src/common/utils.ts @@ -18,6 +18,11 @@ export const decode = (str: string): string => { }; export const isClientSide = (options?: OptionsType) => { + const renderPhase = getRenderPhase(); + if (renderPhase === 'server' && typeof options === 'undefined') { + throw new Error('In server context, options must be provided'); + } + return !options?.req && !options?.res && !(options && 'cookies' in options && (options?.cookies as CookiesFn)); };