Skip to content

Commit 7f91192

Browse files
committed
chore(noSerialize): don't console when bad value
the error is not helpful and it's nicer to just check and ignore
1 parent 9cd62bd commit 7f91192

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/qwik/src/core/state/common.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ export type NoSerialize<T> = (T & { __no_serialize__: true }) | undefined;
150150
*/
151151
// </docs>
152152
export const noSerialize = <T extends object | undefined>(input: T): NoSerialize<T> => {
153-
if (input != null) {
153+
// only add supported values to the noSerializeSet, prevent console errors
154+
if ((typeof input === 'object' && input !== null) || typeof input === 'function') {
154155
noSerializeSet.add(input);
155156
}
156157
return input as any;

0 commit comments

Comments
 (0)