Skip to content

Commit

Permalink
Fix regforms filters not being persisted
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasr8 committed Jun 3, 2024
1 parent 9efa3c9 commit 8d2226a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/pages/participant/ParticipantPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,22 +274,22 @@ function ParticipantTopNav({
regform?: Regform;
participant?: Participant;
}) {
const {state} = useLocation();
const errorModal = useErrorModal();

if (!event || !regform || !participant) {
return <TopNav />;
}
const backNavigateTo = state?.fromRegform ? -1 : `/event/${event.id}/${regform.id}`;

if (participant.price === 0 || !participant.isPaid) {
return (
<TopNav backBtnText={regform.title} backNavigateTo={`/event/${event.id}/${regform.id}`} />
);
return <TopNav backBtnText={regform.title} backNavigateTo={backNavigateTo} />;
}

return (
<TopNav
backBtnText={regform.title}
backNavigateTo={`/event/${event.id}/${regform.id}`}
backNavigateTo={backNavigateTo}
settingsItems={[
{
text: 'Mark as unpaid',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/regform/RegformPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function RegformPageContent({
setSearchData={setSearchData}
onRowClick={async (p: Participant) => {
await wait(50);
navigate(`/event/${event.id}/${regform.id}/${p.id}`);
navigate(`/event/${event.id}/${regform.id}/${p.id}`, {state: {fromRegform: true}});
}}
/>
</div>
Expand Down

0 comments on commit 8d2226a

Please sign in to comment.