Closed
Description
I have a list page and am adding an open/close action button on it. So
tickets = Ticket.find() // ...
const setClosedAt = useCallback(async(ticket: Ticket, closedAt: Date | null) => {
ticket.closedAt = closedAt;
await ticket.save();
// I would expect to call tickets.reload() or ticket.refetch() or something along those lines to invalidate and re-render the page
}, []);
return <Await promise={tickets}>{(tickets) => <table>{tickets.map((ticket) =>
<tr>
<td>{ticket}</td>
<td>{ticket.closedAt
? <button onClick={() => setClosedAt(ticket, null)}>Reopen</button>
: <button onClick={() => setClosedAt(ticket, new Date())}>Close</button>
}</td>
</tr>
})</table>}</Await>;
This is a simple example, in reality I'm using Vite and the data loading and rendering are separated. I don't know if that's playing into it. But as-is, the page does not re-render the table rows after updating the closedAt
field.
Metadata
Metadata
Assignees
Labels
No labels