You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently use a lot of props drilling, with components slicing props types of more than 10 properties, it's difficult to maintain and should be better placed in a context at the top of the hierarchy since those values are all readonly and defined when the component is mounted.
We shouldn't have even one props because everything is passed at the top of the hierarchy.
Please note that it shouldn't be put in FieldContext as it is not in the domain of a Field but of RecordInlineCell which are two different abstractions.
The text was updated successfully, but these errors were encountered:
#6537)
Fixes [#6335](#6335)
This pull request is for issue
[#6335](#6335): Refactor
RecordInlineCell tree with a Context to avoid props drilling. For the
refactoring, this PR made changes as below:
- Created new script RecordInlineCellContext.tsx: Defining a context to
pass in useContext()
- Updated RecordInlineCell.tsx: Passing the necessary props as context
values, wrapping with RecordInlineCellContext.Provider
- Updated RecordInlineCellContainer.tsx: Passing the props to
RecordInlineContainer as RecordInlineCellContext
- Updated RecordInlineCellDisplayMode.tsx: retrieves values from
useRecordInlineCellContext instead of directly assigning them
- RecordInlineCellValue.tsx: Removed values passed through
<RecordInlineCellDisplayMode> as they are now retrieved through
useRecordInlineCellContext + Removed the null check for
RecordInlineCellContextProps.
Using RecordInlineCellContext, I believe the context goes to the top of
the hierarchy and passed to the required layers without going through
several layers. However, please let me know if I understood the issue
incorrectly or it is not solved properly.
Thank you in advance for your review!
---------
Co-authored-by: Lucas Bordeau <[email protected]>
Scope & Context
All the hierarchy of RecordInlineCell components
Technical inputs
We currently use a lot of props drilling, with components slicing props types of more than 10 properties, it's difficult to maintain and should be better placed in a context at the top of the hierarchy since those values are all readonly and defined when the component is mounted.
Example in RecordInlineCellValue :
We shouldn't have even one props because everything is passed at the top of the hierarchy.
Please note that it shouldn't be put in FieldContext as it is not in the domain of a Field but of RecordInlineCell which are two different abstractions.
The text was updated successfully, but these errors were encountered: