-
Notifications
You must be signed in to change notification settings - Fork 6
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
Recordedit performance improvements #2389
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… triggering the overflow logic when the rows would dissapear so the reference to rowConainter.current would still be present. Now that it's delayed, current is updated (next state update cycle) and should be checked before trying to iterate
…nd hide spinner once all are visible
…f forms in this function since it hasn't changed yet anyways. This was a bug that was hidden in previous implementation
… to only occur when an error is present for the current input. Moved logic for activeMultiForm to outside of form-row to prevent rerendering every form row when this prop changes
…Still need to change how avtiveMultiForm is being shared. For a boolean that is controling what row displays or not, a lot of rerendering is occurring since the entire recordedit provider is changing
…provider. Add these as a state variable for recordEditInner to pass to form container and key column for use in those components. This prevents multiple rerenders of the form row components when the row is open/closed
…he above 'datetime.return' is intended for timestampTZ columns and 'timestamp' is intended for timestamp columns
…etting values instead of updating the whole form context
RFSH
approved these changes
Jan 17, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The following changes are made in this pull request to address different performance issues in the recordedit app:
setValueForAllInputs
function to usesetValue
instead ofreset
so only the values for that column are updated in each form instead of updating the whole formDateTimeField
to useuseWatch
instead ofwatch
so it will trigger on the value changing for the individual date and time values instead of any value in the formMultiFormInputRow
to useuseWatch
instead ofwatch
so it will trigger on the value changing for the multi form input value instead of any value in the formactiveMultiForm
andtoggleActiveMultiForm
fromRecordeditProvider
RecordeditInner
componentFormRow
component from re-rendering when theRecordeditProvider
changed theactiveMultiForm
valueKeyColumn
,FormContainer
,FormRow
, andMultiFormInputRow
React.memo
forFormRow
component to prevent re-renders whenFormContainer
re-rendersReact.memo
forInputSwitch
component to prevent re-renders whenFormRow
re-rendersRangeInputs
where the wrong format was being used for timestamp and timestampTZ columnsPotential Further Performance Improvements
I also noted another potential performance improvement for the
callAddForm
function inRecordeditInner
. Instead of updating all of the values and callingreset
, we might want to consider iterating over the forms being added and set each value individually usingsetValue
.In the code I added a lengthy comment that details how this might improve the performance and a contradicting thought. In the end, I decided to leave this unchanged and only added
memo
to theInputSwitch
component so whenreset
is called, this component isn't being re-rendered.