added format command and added trailing commas to reduce conflicts

This commit is contained in:
dswbx
2025-02-26 20:06:03 +01:00
parent 88b5359f1c
commit 7743f71a11
414 changed files with 3622 additions and 3610 deletions

View File

@@ -5,7 +5,7 @@ import {
Type,
decodeSearch,
encodeSearch,
parseDecode
parseDecode,
} from "core/utils";
import { isEqual, transform } from "lodash-es";
import { useLocation, useSearch as useWouterSearch } from "wouter";
@@ -13,7 +13,7 @@ import { useLocation, useSearch as useWouterSearch } from "wouter";
// @todo: migrate to Typebox
export function useSearch<Schema extends TSchema = TSchema>(
schema: Schema,
defaultValue?: Partial<StaticDecode<Schema>>
defaultValue?: Partial<StaticDecode<Schema>>,
) {
const searchString = useWouterSearch();
const [location, navigate] = useLocation();
@@ -34,7 +34,7 @@ export function useSearch<Schema extends TSchema = TSchema>(
if (defaultValue && isEqual(value, defaultValue[key])) return;
result[key] = value;
},
{} as Static<Schema>
{} as Static<Schema>,
);
const encoded = encodeSearch(search, { encode: false });
navigate(location + (encoded.length > 0 ? "?" + encoded : ""));
@@ -42,6 +42,6 @@ export function useSearch<Schema extends TSchema = TSchema>(
return {
value: value as Required<StaticDecode<Schema>>,
set
set,
};
}