Skip to content

Edit form HOC refactor#597

Merged
camdendotlol merged 2 commits intodevelopfrom
cm/clerk-refresh-fix
Apr 15, 2026
Merged

Edit form HOC refactor#597
camdendotlol merged 2 commits intodevelopfrom
cm/clerk-refresh-fix

Conversation

@camdendotlol
Copy link
Copy Markdown
Contributor

@camdendotlol camdendotlol commented Apr 15, 2026

Summary

This PR addresses an issue exposed (but not caused) by the Clerk migration where the edit forms were being defined by a stack of HOCs and HOC-style hooks whose component definitions were not stable when the parent component re-rendered, meaning the form would get remounted every time its parent re-rendered. This never came up before the Clerk migration, because there was nothing that would cause the forms to re-render prior to the user clicking save. But Clerk refreshes its token periodically, causing ClerkProvider (and all its children) to re-render. This meant that these fragile HOC-based forms would periodically unmount, resetting their state including unsaved user input.

The refactor includes copying EditContainer and EditPage from react-components to the CD codebase. Since this is a pretty dramatic change to the code and also the API surface of those components, I decided it wasn't worth taking the time to do a bunch of refactoring on the RC side yet.

This PR also includes a few changes to make the Clerk authentication logic more robust.

@camdendotlol camdendotlol changed the title Record form HOC refactor Edit form HOC refactor Apr 15, 2026
@camdendotlol camdendotlol requested a review from blms April 15, 2026 18:28
Copy link
Copy Markdown
Contributor

@blms blms left a comment

Choose a reason for hiding this comment

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

This looks great!

Could we open an issue, either here or in react-components, for propagating the necessary changes there (and for pulling out any code from here that would be duplicated)—including a basic outline for what needs to be done? Just want to make sure it stays on our radar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants