Skip to content

fix: Fixed redundant re-rendering issues #125

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

Merged
merged 8 commits into from
Oct 1, 2021

Conversation

zashraf1985
Copy link
Contributor

@zashraf1985 zashraf1985 commented Sep 27, 2021

Summary

Made the following re-rendering fixes.

  1. When SDK is initialized using a datafile, hooks were doing an empty first render and the real decision was returned on the second render. Fixed the SDK to render the correct decision on first render when initialized synchronously.
  2. When SDK is initialized with datafile and SDK key both, The hook was being evaluated three times instead of two. Fixed the redundant re-rendering in this case.

Also checked the SDK thoroughly in many combination of sync/async intialization parameters and made fixes where needed.

Test Plan

  1. All unit tests pass.
  2. Tested all the hooks and components thoroughly with hard coded data file, SDK key and both along with async/sync user initialzation and autoUpdate true/false.

2. Fixed extra render on autoupdate
@zashraf1985 zashraf1985 changed the title Fixed some Rerendering issues due to wrong clientReady state fix: Fixed redundant re-rendering issues Sep 27, 2021
@zashraf1985 zashraf1985 marked this pull request as ready for review September 28, 2021 00:22
@zashraf1985 zashraf1985 removed their assignment Sep 28, 2021
@Danny-Driscoll Danny-Driscoll linked an issue Sep 28, 2021 that may be closed by this pull request
@yavorona yavorona self-requested a review October 1, 2021 00:33
Copy link
Contributor

@yavorona yavorona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually thoroughly tested all components and hooks as well. LGTM!

@zashraf1985 zashraf1985 merged commit 5bb710f into master Oct 1, 2021
@zashraf1985 zashraf1985 deleted the zeeshan/client-ready-fix branch October 1, 2021 18:17
@SeanCansdale-Zoopla
Copy link

Hello!

What is the latest with this bug/release? We're using a custom implementation at the moment but are keen to go back to using the SDK, however this bug is stopping us! :)

Can I help at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues with SSR since @optimizely/react-sdk@^2.0.0
3 participants