-
Notifications
You must be signed in to change notification settings - Fork 732
fix: allow adding new field types via overrides #1103
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@jaredhill4 is attempting to deploy a commit to the Measured Team on Vercel. A member of the Team first needs to authorize it. |
chrisvxd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems... too simple. I'll sanity check before merging.
Yea there were a couple considerations:
|
chrisvxd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done some more thinking on this, and it is indeed too good to be true.
You're removing children because it's getting in the way of the user field type specified in overrides, but the children is necessary as overrides expect the default node to be provided to the override as the children prop, which enables the user to wrap the node.
The correct fix for runtime behaviour would be to conditionally check the render function, or default to null (const children = defaultFields[field.type]?.(mergedProps) ?? null;).
However, the type issues are significant and require much further thought before any solution can be merged.
I'm going to close this one out for now whilst I think about the type issues.
Thanks!
|
New attempt at fix: #1147 |
Closes #729.
With this change, developers can now configure their own custom field types like this:
I realize there are likely some type considerations, but it worked for me.
Demo
Screen.Recording.2025-06-12.at.10.52.05.PM.mov