Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

300103 save inputs #1134

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
15 changes: 15 additions & 0 deletions components/StepperPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,14 @@ const StepperPage: React.FC<StepperPageProps> = ({ setPageTitle }) => {
}, [])

const allFieldConfigs: FieldConfig[] = FieldsHandler.getAllFieldData(language)

const [inputs, setInputs]: [
FieldInputsObject,
(value: FieldInputsObject) => void
] = useSessionStorage('inputs', getDefaultInputs(allFieldConfigs))

const savedResults = JSON.parse(sessionStorage.getItem('resultPageInputs'))

const [ageDate, setAgeDate] = useState(
inputs.age ? getBirthMonthAndYear(inputs.age) : null
)
Expand Down Expand Up @@ -90,6 +94,17 @@ const StepperPage: React.FC<StepperPageProps> = ({ setPageTitle }) => {
}
const [receiveOAS, setReceiveOAS] = useState(false)

// Get savedResults, overwite inputs with it.
useEffect(() => {
if (savedResults !== null) {
if ('inputs' in savedResults) {
for (const [key, value] of Object.entries(savedResults.inputs)) {
inputs[key] = value
}
}
}
}, [savedResults])

useEffect(() => {
setSteps(getSteps(tsln))
setStepComponents(getComponentForStep())
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2813,9 +2813,9 @@ __metadata:
linkType: hard

"caniuse-lite@npm:^1.0.30001283, caniuse-lite@npm:^1.0.30001317":
version: 1.0.30001519
resolution: "caniuse-lite@npm:1.0.30001519"
checksum: 66085133ede05d947e30b62fed2cbae18e5767afda8b0de38840883e1cfe5846bf1568ddbafd31647544e59112355abedaf9c867ac34541bfc20d69e7a19d94c
version: 1.0.30001692
resolution: "caniuse-lite@npm:1.0.30001692"
checksum: 484113e3fabbe223fff0380c25c861da265a34c3f75bb5af1f254423b43e713a3c7f0c313167df52fb203f42ea68bd0df8a9e73642becfe1e9fa5734b5fc55a5
languageName: node
linkType: hard

Expand Down
Loading