Skip to content

Commit

Permalink
♻️ [open-formulieren/open-forms#4929] Take initial data reference fro…
Browse files Browse the repository at this point in the history
…m query instead of prop

The FormStart component now grabs the initial data reference directly
from the URL parameters rather than requiring the parent component needing
to do this and pass it down as a prop. This is a first step towards not
needing to specify props at all to FormStart so that it can be included
in the data router routes (statically).
  • Loading branch information
sergei-maertens committed Jan 13, 2025
1 parent 65165d3 commit 4b9c035
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/FormStart/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import AuthenticationOutage, {
} from 'components/auth/AuthenticationOutage';
import {UnprocessableEntity} from 'errors';
import {IsFormDesigner} from 'headers';
import useInitialDataReference from 'hooks/useInitialDataReference';
import useStartSubmission from 'hooks/useStartSubmission';
import useTitle from 'hooks/useTitle';
import Types from 'types';
Expand All @@ -42,7 +43,7 @@ const FormStartMessage = ({form}) => {
* This is shown when the form is initially loaded and provides the explicit user
* action to start the form, or present the login button (DigiD, eHerkenning...)
*/
const FormStart = ({form, submission, onFormStart, onDestroySession, initialDataReference}) => {
const FormStart = ({form, submission, onFormStart, onDestroySession}) => {
const hasActiveSubmission = !!submission;
const isAuthenticated = hasActiveSubmission && submission.isAuthenticated;
const doStart = useStartSubmission();
Expand Down Expand Up @@ -70,6 +71,8 @@ const FormStart = ({form, submission, onFormStart, onDestroySession, initialData
}
}, [doStart, hasAuthErrors, onFormStart]);

const {initialDataReference} = useInitialDataReference();

// do not re-render the login options while we're redirecting
if (doStart && !hasAuthErrors) {
return (
Expand Down

0 comments on commit 4b9c035

Please sign in to comment.