-
Notifications
You must be signed in to change notification settings - Fork 49
fix: compare full EvaluationDetails to prevent stale data #1287
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
Conversation
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Summary of ChangesHello @beeme1mr, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where React components using feature flags might display outdated Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
| }; | ||
|
|
||
| describe('provider ready event updates', () => { | ||
| it('should update EvaluationDetails when provider becomes ready (including reason)', async () => { |
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.
This test failed before I updated the compare.
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.
Code Review
This pull request correctly addresses an issue where components would not update when only the metadata of an EvaluationDetails object changed, by switching from comparing just the value to comparing the entire object. The generalization of the isEqual function to support this and the addition of a specific test case for provider readiness are both excellent improvements. However, I've identified a potential issue in the updated isEqual function where it doesn't distinguish between arrays and objects with numeric keys, which could lead to missed updates in some edge cases. I've left a suggestion to make it more robust.
I think these acceptable limitations. |
I think so too! |
lukas-reining
left a comment
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.
Looks good and makes sense to me!
| * @param {FlagValue} other Second value to compare | ||
| * | ||
| * Note: Does not handle Date, RegExp, Map, Set, or circular references. | ||
| * Suitable for comparing EvaluationDetails and other JSON-serializable data. |
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.
That's a good callout.
MattIPv4
left a comment
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.
Thank you :)
This PR
isEqualfunction to compare any inputRelated Issues
Fixes #1286
Notes
This may trigger slightly more re-renders but I feel that that's better than return stale EvaluationDetails data which has proven to be confusing to folks attempting to debug unexpected evaluations.