fix(MessageEntriesModal): automatically load all pages
Build and Push Docker image / build-and-push (push) Successful in 5m15s
Details
Build and Push Docker image / build-and-push (push) Successful in 5m15s
Details
This commit is contained in:
parent
329b5ba5ff
commit
90e30ed1ae
|
@ -70,7 +70,7 @@ export default function Announcement({announcement}: {
|
||||||
{", Zeitslot "}
|
{", Zeitslot "}
|
||||||
{pprintDateRange(entry.slotStartDate, entry.slotEndDate)}
|
{pprintDateRange(entry.slotStartDate, entry.slotEndDate)}
|
||||||
{", "}
|
{", "}
|
||||||
{humanDeltaFromNow(entry.created).message}
|
{humanDeltaFromNow(entry.slotStartDate).message}
|
||||||
</List.Item>
|
</List.Item>
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
|
|
|
@ -9,6 +9,7 @@ import TextEditor from "@/components/input/Editor";
|
||||||
import ListSelect from "@/pages/events/e/:eventId/EventLists/ListSelect.tsx";
|
import ListSelect from "@/pages/events/e/:eventId/EventLists/ListSelect.tsx";
|
||||||
import {showSuccessNotification} from "@/components/util.tsx";
|
import {showSuccessNotification} from "@/components/util.tsx";
|
||||||
import {usePB} from "@/lib/pocketbase.tsx";
|
import {usePB} from "@/lib/pocketbase.tsx";
|
||||||
|
import {useEffect} from "react";
|
||||||
|
|
||||||
|
|
||||||
export default function MessageEntriesModal({opened, event, onClose, query}: {
|
export default function MessageEntriesModal({opened, event, onClose, query}: {
|
||||||
|
@ -34,11 +35,18 @@ export default function MessageEntriesModal({opened, event, onClose, query}: {
|
||||||
selectedLists: [] as EventListModel[],
|
selectedLists: [] as EventListModel[],
|
||||||
},
|
},
|
||||||
validate: {
|
validate: {
|
||||||
subject: hasLength({max: 255}, "Der Betreff ist zu lang"),
|
subject: hasLength({max: 255}, "Der Betreff ist zu lang (max. 255 Zeichen)"),
|
||||||
content: hasLength({min: 10, max: 5000}, "Die Nachricht muss zwischen 10 und 5000 Zeichen lang sein"),
|
content: hasLength({min: 10, max: 10000}, "Die Nachricht muss zwischen 10 und 10000 Zeichen lang sein"),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Fetch all pages
|
||||||
|
useEffect(() => {
|
||||||
|
if (opened && query.hasNextPage && !query.isFetchingNextPage) {
|
||||||
|
query.fetchNextPage()
|
||||||
|
}
|
||||||
|
}, [opened, query])
|
||||||
|
|
||||||
const mutation = useMutation({
|
const mutation = useMutation({
|
||||||
mutationFn: async () => {
|
mutationFn: async () => {
|
||||||
await pb.collection("messages").create({
|
await pb.collection("messages").create({
|
||||||
|
|
Loading…
Reference in New Issue