On a workspace's rfps page, the open/close state changes inaccurately when clicking in and out of an RFP:
when clicking to the second page, then clicking on an RFP, then clicking to go back to the RFPs page, the rfp's open/close state is inaccurate.
The problem is we're reading the RFP's state from two different sources, the db and local state.
When we are clicking through the different pages, the change in props of the RFPCard doesn't a trigger a re-render of the RfpCard's local state, but the data from the db has changed due to the new RFPs being fetched via pagination.
We run into an issue of wanting to trigger a re-render of the RFPCard which would change the local state, but then changing the local state would defeat its purpose for optimistically modifying the open/close state when the rfp's start date / end date dynamically changes.
The fix is to rely on one source of truth (the db) and refetch the data in the useScheduleCallback hook instead of changing local state.
Additionally, I added a query param so that when you click into the RFP that's a few pages in and then go back to the rfps page, you land on the same source page.
Motivation & Context
Ali recently messaged us pointing out this issue:
Steps to test
Visit a workspace with multiple pages of RFPs with different open/close states
Click to a page that's not the first on the workspace rfps tab
Click into an RFP
Navigate back to the workspace's rfps tab
Ensure the open/close state hasn't changed and that you land on the same page that displays the RFP you clicked into.
What's included in this pr + description
On a workspace's rfps page, the open/close state changes inaccurately when clicking in and out of an RFP: when clicking to the second page, then clicking on an RFP, then clicking to go back to the RFPs page, the rfp's open/close state is inaccurate.
The problem is we're reading the RFP's state from two different sources, the db and local state.
When we are clicking through the different pages, the change in props of the RFPCard doesn't a trigger a re-render of the
RfpCard
's local state, but the data from the db has changed due to the new RFPs being fetched via pagination.We run into an issue of wanting to trigger a re-render of the RFPCard which would change the local state, but then changing the local state would defeat its purpose for optimistically modifying the open/close state when the rfp's start date / end date dynamically changes.
The fix is to rely on one source of truth (the db) and refetch the data in the
useScheduleCallback
hook instead of changing local state.Additionally, I added a query param so that when you click into the RFP that's a few pages in and then go back to the rfps page, you land on the same source page.
Motivation & Context
Ali recently messaged us pointing out this issue:
Steps to test