Skip to content

Conversation

@joaquincasal
Copy link
Collaborator

Purpose

The app currently displays an error message if a field uses a custom appearance.

Approach

We are not able to render the custom appearance but we can still render the default field editor for the underlying field type.

Before

Screen.Recording.2025-11-20.at.11.22.51.mov

After

Screen.Recording.2025-11-20.at.11.33.11.mov

@joaquincasal joaquincasal requested a review from a team as a code owner November 20, 2025 14:39
}

const ERROR_MESSAGE = 'Failed to initialize field editor. Please try again.';
const SUPPORTED_WIDGET_IDS = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Small suggestion: Make this a map/hashmap data structure instead of an array to make the lookup efficient on line 147

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, I've changed it to use a Set so the lookup is faster

Copy link
Contributor

@ryunsong-contentful ryunsong-contentful left a comment

Choose a reason for hiding this comment

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

Overall looks good, let me know what you think of the small fix and I can approve afterwards

}, [field, value, onChange, locale]);

const getWidgetId = (field: ContentTypeField) => {
const fieldTypeToDefaultWidget: Record<string, string> = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why this isn't a constant outside of the component so that this data doesn't rerender?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not really, I've moved it

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.

3 participants