Skip to content

Commit 5011336

Browse files
committed
.
1 parent e5c74de commit 5011336

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

packages/leva/src/plugins/Select/select-plugin.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import type { SelectInput, InternalSelectSettings } from './select-types'
22
import { z } from 'zod'
33

4-
const zValidPrimitive = z.union([z.string(), z.number(), z.boolean(), z.function()])
4+
// Use z.custom() for functions instead of z.function() to preserve function identity.
5+
// z.function() wraps values in zod proxies, changing their references.
6+
const zValidPrimitive = z.union([
7+
z.string(),
8+
z.number(),
9+
z.boolean(),
10+
z.custom<Function>((v) => typeof v === 'function'),
11+
])
512

613
/**
714
* Schema for the usecase

packages/leva/stories/inputs/Select.stories.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react'
22
import type { Meta, StoryObj } from '@storybook/react'
33
import { expect, within, userEvent, waitFor } from 'storybook/test'
4-
import { vi } from 'vitest'
54

65
import Reset from '../components/decorator-reset'
76

0 commit comments

Comments
 (0)