diff --git a/packages/pl-fe/package.json b/packages/pl-fe/package.json index c5ea26e27..0d16d8753 100644 --- a/packages/pl-fe/package.json +++ b/packages/pl-fe/package.json @@ -147,7 +147,6 @@ "vite-plugin-require": "^1.2.14", "vite-plugin-static-copy": "^1.0.6", "wicg-inert": "^3.1.3", - "zod": "^3.23.8", "zustand": "^5.0.0-rc.2" }, "devDependencies": { diff --git a/packages/pl-fe/src/entity-store/hooks/useBatchedEntities.ts b/packages/pl-fe/src/entity-store/hooks/useBatchedEntities.ts index 746452753..40aa0f523 100644 --- a/packages/pl-fe/src/entity-store/hooks/useBatchedEntities.ts +++ b/packages/pl-fe/src/entity-store/hooks/useBatchedEntities.ts @@ -1,5 +1,5 @@ import { useEffect } from 'react'; -import { z } from 'zod'; +import * as v from 'valibot'; import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; @@ -29,7 +29,7 @@ const useBatchedEntities = ( const getState = useGetState(); const dispatch = useAppDispatch(); const { entityType, listKey, path } = parseEntitiesPath(expandedPath); - const schema = opts.schema || z.custom(); + const schema = opts.schema || v.custom(() => true); const isEnabled = opts.enabled ?? true; const isFetching = useListState(path, 'fetching'); diff --git a/packages/pl-fe/src/entity-store/hooks/useCreateEntity.ts b/packages/pl-fe/src/entity-store/hooks/useCreateEntity.ts index 68ede31e7..a7ff90741 100644 --- a/packages/pl-fe/src/entity-store/hooks/useCreateEntity.ts +++ b/packages/pl-fe/src/entity-store/hooks/useCreateEntity.ts @@ -1,4 +1,4 @@ -import { z } from 'zod'; +import * as v from 'valibot'; import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; import { useLoading } from 'pl-fe/hooks/useLoading'; @@ -31,7 +31,7 @@ const useCreateEntity = = {}, ): Promise => { const result = await setPromise(entityFn(data)); - const schema = opts.schema || z.custom(); + const schema = opts.schema || v.custom(() => true); let entity: TEntity | TTransformedEntity = v.parse(schema, result); if (opts.transform) entity = opts.transform(entity); diff --git a/packages/pl-fe/src/entity-store/hooks/useEntities.ts b/packages/pl-fe/src/entity-store/hooks/useEntities.ts index 30629a0da..a6de94ac4 100644 --- a/packages/pl-fe/src/entity-store/hooks/useEntities.ts +++ b/packages/pl-fe/src/entity-store/hooks/useEntities.ts @@ -43,7 +43,7 @@ const useEntities = selectEntities(state, path)); - const schema = opts.schema || z.custom(); + const schema = opts.schema || v.custom(() => true); const isEnabled = opts.enabled ?? true; const isFetching = useListState(path, 'fetching'); diff --git a/packages/pl-fe/src/entity-store/hooks/useEntity.ts b/packages/pl-fe/src/entity-store/hooks/useEntity.ts index 793434014..2cd808b37 100644 --- a/packages/pl-fe/src/entity-store/hooks/useEntity.ts +++ b/packages/pl-fe/src/entity-store/hooks/useEntity.ts @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react'; -import z from 'zod'; +import * as v from 'valibot'; import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; @@ -35,7 +35,7 @@ const useEntity = (); + const defaultSchema = v.custom(() => true); const schema = opts.schema || defaultSchema; const entity = useAppSelector(state => selectEntity(state, entityType, entityId)); diff --git a/packages/pl-fe/src/entity-store/hooks/useEntityLookup.ts b/packages/pl-fe/src/entity-store/hooks/useEntityLookup.ts index a8dd9d6c8..a59be3c67 100644 --- a/packages/pl-fe/src/entity-store/hooks/useEntityLookup.ts +++ b/packages/pl-fe/src/entity-store/hooks/useEntityLookup.ts @@ -1,6 +1,5 @@ import { useEffect, useState } from 'react'; import * as v from 'valibot'; -import { z } from 'zod'; import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; @@ -23,7 +22,7 @@ const useEntityLookup = , opts: UseEntityOpts = {}, ) => { - const { schema = z.custom() } = opts; + const { schema = v.custom(() => true) } = opts; const dispatch = useAppDispatch(); const [fetchedEntity, setFetchedEntity] = useState();