Skip to content

Commit

Permalink
fix(#213): clear form cache on first page submit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jumpy-Squirrel committed Jan 13, 2024
1 parent d8f3d24 commit 45223a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/state/epics/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const loadRegistrationIfSafe = () => registrationCountdownCheck().pipe(
concatMap(result => {
if (result.response.countdown > 0) {
return of(LoadRegistrationState.create({ isOpen: false }))
} else if (isBefore(new Date(result.response.currentTime), addHours(new Date(result.response.targetTime), config.hoursBeforeEditAvailable))) {
return loadUnsubmittedRegistration()
// } else if (isBefore(new Date(result.response.currentTime), addHours(new Date(result.response.targetTime), config.hoursBeforeEditAvailable))) {
// return loadUnsubmittedRegistration()
} else {
return loadRegistration()
}
Expand Down
4 changes: 4 additions & 0 deletions src/state/reducers/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { LoadRegistrationState, SetLocale } from '~/state/actions/register'
import config from '~/config'
import { DateTime } from 'luxon'
import { determineDefaultAddons } from '~/state/selectors/forms'
import { clearFormCache } from "~/hooks/funnels/form";

Check failure on line 9 in src/state/reducers/register.ts

View workflow job for this annotation

GitHub Actions / build-and-test

Strings must use singlequote

Check failure on line 9 in src/state/reducers/register.ts

View workflow job for this annotation

GitHub Actions / build-and-test

Extra semicolon

export interface ClosedRegisterState {
readonly isOpen: false | null
Expand Down Expand Up @@ -65,6 +66,9 @@ const resetAddonsInState = (state: Partial<RegistrationInfo>, ticketType: 'day'
const registrationInfoReducer = (state: Partial<RegistrationInfo>, action: GetAction<AnyAppAction>): Partial<RegistrationInfo> => {
switch (action.type) {
case SubmitForm('register-ticket-type').type: {
// clear the form cache - not an ideal solution, but it works
clearFormCache()

// here we can force reset ticket addons to defaults (different hidden packages, different defaults)
if (action.payload.type === 'day') {
// not setting ticketType - it is set when choosing a day
Expand Down

0 comments on commit 45223a5

Please sign in to comment.