better handling of empty lists
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
type Component,
|
||||
type ParentProps,
|
||||
createContext,
|
||||
createEffect,
|
||||
createMemo,
|
||||
createResource,
|
||||
useContext,
|
||||
@@ -29,6 +30,10 @@ const SearchImageContext = createContext<SearchImageStore>();
|
||||
export const SearchImageContextProvider: Component<ParentProps> = (props) => {
|
||||
const [data, { refetch }] = createResource(getUserImages);
|
||||
|
||||
createEffect(() => {
|
||||
console.log(data());
|
||||
});
|
||||
|
||||
const sortedImages = createMemo<ReturnType<SearchImageStore["imagesByDate"]>>(
|
||||
() => {
|
||||
const d = data();
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
pipe,
|
||||
strictObject,
|
||||
string,
|
||||
transform,
|
||||
union,
|
||||
uuid,
|
||||
} from "valibot";
|
||||
@@ -127,20 +128,25 @@ const listValidator = strictObject({
|
||||
Name: string(),
|
||||
Description: nullable(string()),
|
||||
|
||||
Images: array(
|
||||
strictObject({
|
||||
ID: pipe(string(), uuid()),
|
||||
ImageID: pipe(string(), uuid()),
|
||||
ListID: pipe(string(), uuid()),
|
||||
Items: array(
|
||||
Images: pipe(
|
||||
nullable(
|
||||
array(
|
||||
strictObject({
|
||||
ID: pipe(string(), uuid()),
|
||||
ImageID: pipe(string(), uuid()),
|
||||
SchemaItemID: pipe(string(), uuid()),
|
||||
Value: string(),
|
||||
ListID: pipe(string(), uuid()),
|
||||
Items: array(
|
||||
strictObject({
|
||||
ID: pipe(string(), uuid()),
|
||||
ImageID: pipe(string(), uuid()),
|
||||
SchemaItemID: pipe(string(), uuid()),
|
||||
Value: string(),
|
||||
}),
|
||||
),
|
||||
}),
|
||||
),
|
||||
}),
|
||||
),
|
||||
transform((n) => n ?? []),
|
||||
),
|
||||
|
||||
Schema: strictObject({
|
||||
|
||||
Reference in New Issue
Block a user