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

Hotfix: Fix Routing Form Saving related issue #4954

Merged

Conversation

hariombalhara
Copy link
Member

@hariombalhara hariombalhara commented Oct 11, 2022

Fixes #4950

The issue seems to occur with a combination of following:

  • Code should be compiled(not in dev mode. This is the reason this bug doesn't replicate normally on local as we use dev mode)
  • Middleware should be used(which we started using a month or 2 back)

Solution, is to use tRPC fetched form for rendering, which would be invalidated on every save and works correctly.

@vercel
Copy link

vercel bot commented Oct 11, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
cal ❌ Failed (Inspect) Oct 11, 2022 at 3:50PM (UTC)

@hariombalhara hariombalhara changed the base branch from production to main October 11, 2022 15:37
@hariombalhara hariombalhara changed the title Sync submodules Hotfix: Fix Routing Form Saving related issue Oct 11, 2022
@hariombalhara hariombalhara requested a review from a team October 11, 2022 15:41
@PeerRich PeerRich enabled auto-merge (squash) October 11, 2022 15:44
@PeerRich PeerRich enabled auto-merge (squash) October 11, 2022 15:44
Copy link
Member Author

@hariombalhara hariombalhara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self reviewed

@@ -262,3 +259,20 @@ export default function SingleForm({
</Form>
);
}

export default function SingleFormWrapper({ form: _form, ...props }: SingleFormComponentProps) {
const { data: form, isLoading } = trpc.useQuery(["viewer.app_routing_forms.formQuery", { id: _form.id }], {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we are using tRPC now, it is important that useForm is called in a child component which is rendered only when form is available. THis is to avoid initialization of useForm with defaultValues:undefined

@@ -175,35 +175,32 @@ const Actions = ({
);
};

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix Eslint warning in a follow up PR>

@PeerRich PeerRich merged commit 7e5c686 into main Oct 11, 2022
@PeerRich PeerRich deleted the fix/routing-form-weird-not-saving-issue-with-compiled-next.js branch October 11, 2022 15:52
hariombalhara added a commit that referenced this pull request Oct 11, 2022
PeerRich pushed a commit that referenced this pull request Oct 11, 2022
@PeerRich PeerRich added the core area: core, team members only label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core area: core, team members only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-54] SIU routing forms not saving
2 participants