-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix console errors #10111
base: main
Are you sure you want to change the base?
Fix console errors #10111
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,16 +45,14 @@ export const getRecordNodeFromRecord = <T extends ObjectRecord>({ | |
} | ||
|
||
const nestedRecord = Object.fromEntries( | ||
Object.entries(record) | ||
.map(([fieldName, value]) => { | ||
objectMetadataItem.fields | ||
.map((field) => { | ||
const fieldName = field.name; | ||
const value = record[fieldName]; | ||
if (isDefined(recordGqlFields) && !recordGqlFields[fieldName]) { | ||
return undefined; | ||
} | ||
|
||
const field = objectMetadataItem.fields.find( | ||
(field) => field.name === fieldName, | ||
); | ||
|
||
if (isUndefined(field)) { | ||
return undefined; | ||
} | ||
|
@@ -79,7 +77,7 @@ export const getRecordNodeFromRecord = <T extends ObjectRecord>({ | |
getRecordConnectionFromRecords({ | ||
objectMetadataItems, | ||
objectMetadataItem: oneToManyObjectMetadataItem, | ||
records: value as ObjectRecord[], | ||
records: (value || []) as ObjectRecord[], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i understand the changes too, I'm not agaist them but we should add tests on these |
||
recordGqlFields: | ||
recordGqlFields?.[fieldName] === true || | ||
isUndefined(recordGqlFields?.[fieldName]) | ||
|
@@ -144,7 +142,7 @@ export const getRecordNodeFromRecord = <T extends ObjectRecord>({ | |
]; | ||
} | ||
default: { | ||
return [fieldName, value]; | ||
return [fieldName, value || null]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here. And we should make sure that {} ends up being returned as null |
||
} | ||
} | ||
}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -277,9 +277,10 @@ const TextInputV2Component = ( | |
); | ||
}; | ||
|
||
const TextInputV2WithAutoGrowWrapper = ( | ||
props: TextInputV2WithAutoGrowWrapperProps, | ||
) => ( | ||
const TextInputV2WithAutoGrowWrapper = forwardRef< | ||
HTMLInputElement, | ||
TextInputV2WithAutoGrowWrapperProps | ||
>((props, _) => ( | ||
<> | ||
{props.autoGrow ? ( | ||
<ComputeNodeDimensions node={props.value || props.placeholder}> | ||
|
@@ -293,6 +294,6 @@ const TextInputV2WithAutoGrowWrapper = ( | |
<TextInputV2Component {...props} /> | ||
)} | ||
</> | ||
); | ||
)); | ||
|
||
export const TextInputV2 = forwardRef(TextInputV2WithAutoGrowWrapper); | ||
export const TextInputV2 = TextInputV2WithAutoGrowWrapper; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't we need the forwardRef anymore in some case? Not sure why we used it before? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can see that AddressInput is passing a ref for example to handle the focus direclty @bosiraphael has change the component to enable autogrow but this ref should be forwared into the subcomponent TextInputV2Component There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @charlesBochet so you think I should remove the forwardRef completely? |
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.
agree that we should pilot the utils by the metadata and not the record sturcture but might have a lot of side effects in this app, we need to test everything then