Component | Graph: Add shouldDataUpdate option to control update behavior #13
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.
This PR contains the following tweaks:
The
isEqual
function inutils/data.ts
has been updated to accept an optionalskipKeys
parameter. This allows ignoring specific keys when comparing objects for equality.The
Graph
component has been updated to include a newshouldDataUpdate
option in theGraphConfigInterface
. This option allows developers to provide a custom function to determine whether the component should update when new data is provided.By default, the
isEqual
function from theutils/data
module is used to compare the previous and new data. However, developers can now supply their own comparison logic, which is useful for complex nested data structures where the default equality check may not be sufficient.This change improves the flexibility and control over the update behavior of the
Graph
component, enabling developers to optimize performance and reduce unnecessary re-renders when the data has not meaningfully changed.