chore: ensure compat type definitions do not break existing types (#11741)

This commit is contained in:
Greg Pabian authored and GitHub committed 2023-10-10 14:50:15 -07:00
1 parent 0f92afb4bd
commit 39c3ef0d94
8 files changed
+31 -12

No files matched your search

+7 -3
View File
@@ -95,7 +95,9 @@ function CategoryTab({ selectedCategory, categories, searchText }: CategoryTabPr
ref={ref}>
<li
onClick={() => {
router.replace(pathname);
if (pathname !== null) {
router.replace(pathname);
}
}}
className={classNames(
selectedCategory === null ? "bg-emphasis text-default" : "bg-muted text-emphasis",
@@ -108,9 +110,11 @@ function CategoryTab({ selectedCategory, categories, searchText }: CategoryTabPr
key={pos}
onClick={() => {
if (selectedCategory === cat) {
router.replace(pathname);
if (pathname !== null) {
router.replace(pathname);
}
} else {
const _searchParams = new URLSearchParams(searchParams);
const _searchParams = new URLSearchParams(searchParams ?? undefined);
_searchParams.set("category", cat);
router.replace(`${pathname}?${_searchParams.toString()}`);
}
+3 -1
View File
@@ -190,7 +190,9 @@ const InstallAppButtonChild = ({
const mutation = useAddAppMutation(null, {
onSuccess: (data) => {
// Refresh SSR page content without actual reload
router.replace(pathname);
if (pathname !== null) {
router.replace(pathname);
}
if (data?.setupPending) return;
showToast(t("app_successfully_installed"), "success");
},
@@ -50,7 +50,7 @@ export const BreadcrumbContainer = () => {
useEffect(() => {
const rawPath = pathname; // Pathname doesn't include search params anymore
let pathArray = rawPath.split("/");
let pathArray = rawPath?.split("/") ?? [];
pathArray.shift();
pathArray = pathArray.filter((path) => path !== "");
@@ -60,7 +60,7 @@ export function CreateButton(props: CreateBtnProps) {
// inject selection data into url for correct router history
const openModal = (option: Option) => {
const _searchParams = new URLSearchParams(searchParams);
const _searchParams = new URLSearchParams(searchParams ?? undefined);
function setParamsIfDefined(key: string, value: string | number | boolean | null | undefined) {
if (value !== undefined && value !== null) _searchParams.set(key, value.toString());
}
@@ -136,7 +136,7 @@ export function CreateButton(props: CreateBtnProps) {
</DropdownMenuContent>
</Dropdown>
)}
{searchParams.get("dialog") === "new" && CreateDialog}
{searchParams?.get("dialog") === "new" && CreateDialog}
</>
);
}
+1 -1
View File
@@ -28,7 +28,7 @@ export function Dialog(props: DialogProps) {
const router = useRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
const newSearchParams = new URLSearchParams(searchParams);
const newSearchParams = new URLSearchParams(searchParams ?? undefined);
const { children, name, ...dialogProps } = props;
// only used if name is set