Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/adapter-next/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
type InferFormFieldTree,
type UseFormOptions,
type UseFormResult,
useForm as createForm,
} from '@holo-js/forms/client'
createFormClient,
} from '@holo-js/forms/internal/client'

export {
type ClientSubmitContext,
Expand All @@ -19,7 +19,7 @@ export {
type UseFormOptions,
type UseFormResult,
type ValidateOnMode,
} from '@holo-js/forms/client'
} from '@holo-js/forms/internal/client'

function isPlainObject(value: unknown): value is Record<string, unknown> {
return !!value && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Date) && !(value instanceof Blob)
Expand Down Expand Up @@ -112,13 +112,13 @@ export function useForm<TSchema extends FormSchema, TSuccess = unknown>(
!formRef.current
|| previousSchemaRef.current !== schemaDefinition
) {
formRef.current = createForm(schemaDefinition, resolvedOptions)
formRef.current = createFormClient(schemaDefinition, resolvedOptions)
previousSchemaRef.current = schemaDefinition
previousOptionsRef.current = options
} else {
const previousOptions = previousOptionsRef.current as UseFormOptions<TData, TSuccess>
if (!areOptionsEqual(previousOptions, options)) {
formRef.current = createForm(schemaDefinition, resolvedOptions)
formRef.current = createFormClient(schemaDefinition, resolvedOptions)
previousOptionsRef.current = options
}
}
Expand Down
30 changes: 15 additions & 15 deletions packages/adapter-next/tests/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('@holo-js/adapter-next client', () => {
vi.resetModules()
vi.clearAllMocks()
vi.doUnmock('react')
vi.doUnmock('@holo-js/forms/client')
vi.doUnmock('@holo-js/forms/internal/client')
})

it('wraps the shared form client with a React subscription bridge', async () => {
Expand All @@ -54,8 +54,8 @@ describe('@holo-js/adapter-next client', () => {
},
}

vi.doMock('@holo-js/forms/client', () => ({
useForm: vi.fn(() => fakeForm),
vi.doMock('@holo-js/forms/internal/client', () => ({
createFormClient: vi.fn(() => fakeForm),
}))

vi.doMock('react', () => createReactMock({
Expand Down Expand Up @@ -115,8 +115,8 @@ describe('@holo-js/adapter-next client', () => {
hookValues: [],
}

vi.doMock('@holo-js/forms/client', () => ({
useForm: vi.fn((_schema, options: { initialValues?: { email?: string } }) => ({
vi.doMock('@holo-js/forms/internal/client', () => ({
createFormClient: vi.fn((_schema, options: { initialValues?: { email?: string } }) => ({
subscribe() {
return () => {}
},
Expand Down Expand Up @@ -217,8 +217,8 @@ describe('@holo-js/adapter-next client', () => {
},
}))

vi.doMock('@holo-js/forms/client', () => ({
useForm: createForm,
vi.doMock('@holo-js/forms/internal/client', () => ({
createFormClient: createForm,
}))

vi.doMock('react', () => createReactMock({
Expand Down Expand Up @@ -306,8 +306,8 @@ describe('@holo-js/adapter-next client', () => {
},
}))

vi.doMock('@holo-js/forms/client', () => ({
useForm: createForm,
vi.doMock('@holo-js/forms/internal/client', () => ({
createFormClient: createForm,
}))

vi.doMock('react', () => createReactMock({
Expand Down Expand Up @@ -418,8 +418,8 @@ describe('@holo-js/adapter-next client', () => {
},
}))

vi.doMock('@holo-js/forms/client', () => ({
useForm: createForm,
vi.doMock('@holo-js/forms/internal/client', () => ({
createFormClient: createForm,
}))

vi.doMock('react', () => createReactMock({
Expand Down Expand Up @@ -514,8 +514,8 @@ describe('@holo-js/adapter-next client', () => {
}
})

vi.doMock('@holo-js/forms/client', () => ({
useForm: createForm,
vi.doMock('@holo-js/forms/internal/client', () => ({
createFormClient: createForm,
}))

vi.doMock('react', () => createReactMock({
Expand Down Expand Up @@ -606,8 +606,8 @@ describe('@holo-js/adapter-next client', () => {
},
}))

vi.doMock('@holo-js/forms/client', () => ({
useForm: createForm,
vi.doMock('@holo-js/forms/internal/client', () => ({
createFormClient: createForm,
}))

vi.doMock('react', () => createReactMock({
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-next/tests/package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('@holo-js/adapter-next package boundaries', () => {
const runtimeEntry = await readFile(runtimeEntryPath, 'utf8')

expect(indexEntry).not.toContain("@holo-js/forms")
expect(clientEntry).toContain("@holo-js/forms/client")
expect(clientEntry).toContain("@holo-js/forms/internal/client")
expect(clientEntry).not.toContain("@holo-js/auth")
expect(runtimeEntry).not.toContain("@holo-js/forms")
expect(runtimeEntry).not.toContain("@holo-js/auth")
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-next/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@holo-js/config": ["../config/src/index.ts"],
"@holo-js/core": ["../core/src/index.ts"],
"@holo-js/forms": ["../forms/src/index.ts"],
"@holo-js/forms/client": ["../forms/src/client.ts"],
"@holo-js/forms/internal/client": ["../forms/src/internal/client.ts"],
"@holo-js/security": ["../security/src/index.ts"],
"@holo-js/security/client": ["../security/src/client.ts"],
"@holo-js/session": ["../session/src/index.ts"],
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-next/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default defineConfig({
'@holo-js/db-postgres': resolve(__dirname, '../db-postgres/src/index.ts'),
'@holo-js/db-sqlite': resolve(__dirname, '../db-sqlite/src/index.ts'),
'@holo-js/events': resolve(__dirname, '../events/src/index.ts'),
'@holo-js/forms/client': resolve(__dirname, '../forms/src/client.ts'),
'@holo-js/forms/internal/client': resolve(__dirname, '../forms/src/internal/client.ts'),
'@holo-js/forms': resolve(__dirname, '../forms/src/index.ts'),
'@holo-js/queue': resolve(__dirname, '../queue/src/index.ts'),
'@holo-js/queue-redis': resolve(__dirname, '../queue-redis/src/index.ts'),
Expand Down
4 changes: 2 additions & 2 deletions packages/adapter-nuxt/src/runtime/composables/forms.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export type {
UseFormOptions,
UseFormResult,
ValidateOnMode,
} from '@holo-js/forms/client'
} from '@holo-js/forms/internal/client'

export declare const useForm: typeof import('@holo-js/forms/client').useForm
export declare const useForm: typeof import('@holo-js/forms/internal/client').createFormClient
Loading