fix: no result for oo headline (#26289)
This commit is contained in:
1 parent
00e5770273
commit
23c4e7edef
1 file changed
+13
-13
@@ -135,9 +135,19 @@ function OutOfOfficeEntriesListContent({
|
|||||||
const flatData = useMemo(
|
const flatData = useMemo(
|
||||||
() =>
|
() =>
|
||||||
isPending || isFetching ? new Array(5).fill(null) : data?.pages?.flatMap((page) => page.rows) ?? [],
|
isPending || isFetching ? new Array(5).fill(null) : data?.pages?.flatMap((page) => page.rows) ?? [],
|
||||||
[data, selectedTab, isPending, isFetching, searchTerm]
|
[data, isPending, isFetching]
|
||||||
) as OutOfOfficeEntry[];
|
) as OutOfOfficeEntry[];
|
||||||
|
|
||||||
|
const deleteOutOfOfficeEntryMutation = trpc.viewer.ooo.outOfOfficeEntryDelete.useMutation({
|
||||||
|
onSuccess: () => {
|
||||||
|
showToast(t("success_deleted_entry_out_of_office"), "success");
|
||||||
|
setDeletedEntry((previousValue) => previousValue + 1);
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
showToast(`An error occurred`, "error");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const memoColumns = useMemo(() => {
|
const memoColumns = useMemo(() => {
|
||||||
const columnHelper = createColumnHelper<OutOfOfficeEntry>();
|
const columnHelper = createColumnHelper<OutOfOfficeEntry>();
|
||||||
return [
|
return [
|
||||||
@@ -333,7 +343,7 @@ function OutOfOfficeEntriesListContent({
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
}, [selectedTab, isPending, isFetching, onOpenEditDialog, t]);
|
}, [selectedTab, isPending, isFetching, onOpenEditDialog, t, deleteOutOfOfficeEntryMutation, totalRowCount]);
|
||||||
|
|
||||||
const table = useReactTable({
|
const table = useReactTable({
|
||||||
data: flatData,
|
data: flatData,
|
||||||
@@ -349,16 +359,6 @@ function OutOfOfficeEntriesListContent({
|
|||||||
getFilteredRowModel: getFilteredRowModel(),
|
getFilteredRowModel: getFilteredRowModel(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const deleteOutOfOfficeEntryMutation = trpc.viewer.ooo.outOfOfficeEntryDelete.useMutation({
|
|
||||||
onSuccess: () => {
|
|
||||||
showToast(t("success_deleted_entry_out_of_office"), "success");
|
|
||||||
setDeletedEntry((previousValue) => previousValue + 1);
|
|
||||||
},
|
|
||||||
onError: () => {
|
|
||||||
showToast(`An error occurred`, "error");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DataTableWrapper
|
<DataTableWrapper
|
||||||
@@ -388,7 +388,7 @@ function OutOfOfficeEntriesListContent({
|
|||||||
EmptyView={
|
EmptyView={
|
||||||
<EmptyScreen
|
<EmptyScreen
|
||||||
className="mt-6"
|
className="mt-6"
|
||||||
headline={selectedTab === OutOfOfficeTab.TEAM ? t("ooo_team_empty_title") : t("ooo_empty_title")}
|
headline={searchTerm ? t("no_result_found_for", {searchTerm}) : selectedTab === OutOfOfficeTab.TEAM ? t("ooo_team_empty_title") : t("ooo_empty_title")}
|
||||||
description={
|
description={
|
||||||
selectedTab === OutOfOfficeTab.TEAM
|
selectedTab === OutOfOfficeTab.TEAM
|
||||||
? t("ooo_team_empty_description")
|
? t("ooo_team_empty_description")
|
||||||
|
|||||||
Reference in new issue
Block a user