Skip to content
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

fix(config-cat): Rework error reporting #1242

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

adams85
Copy link
Contributor

@adams85 adams85 commented Mar 26, 2025

This PR

Attempts to fix #1212 by reworking error reporting. (More on the reason for the change in the related issue.)

Related Issues

Fixes #1212

Notes

This PR is not meant to be a complete solution, more of a quick fix to the related issue. It should be revised and improved later.

Follow-up Tasks

n/a

How to test

n/a

@adams85 adams85 requested a review from a team as a code owner March 26, 2025 18:39
@adams85 adams85 marked this pull request as draft March 26, 2025 18:39
@github-actions github-actions bot requested a review from lukas-reining March 26, 2025 18:39
Copy link
Member

@beeme1mr beeme1mr left a comment

Choose a reason for hiding this comment

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

This approach seems good to me. I think it's a good idea to offload the majority of the status logic to the SDK.

this._hasError = false;
this.events.emit(ProviderEvents.Ready);
this._isProviderReady = true;
setTimeout(() => this.events.emit(ProviderEvents.Ready), 0);
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason to not emit this event right away? Also, this will likely trigger a re-render in the React SDK but it should no longer trigger a re-render loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's just that it doesn't feel right to invoke unknown user code during the evaluation of a feature flag, when normally that code would be invoked asynchronously, on the client's "background" polling loop. (As I mentioned in the related issue, the necessary event is not emitted by ConfigCat client at the moment but it's planned to be implement soon.)

Regardless, I'm ok with emitting the event synchronously if you say it's fine.

Copy link
Member

Choose a reason for hiding this comment

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

The event would take two event loop cycles to run but I don't think it's a big deal either way. It's up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, then I'd leave it as is.

@beeme1mr beeme1mr requested a review from toddbaert March 27, 2025 17:21
Signed-off-by: Adam Simon <[email protected]>
@adams85 adams85 marked this pull request as ready for review March 27, 2025 21:24
@lukas-reining
Copy link
Member

Sorry for the delay @adams85, many of us were at KubeCon last week.
Will review tomorrow :)

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.

Config-cat-web causes infinite rerenders with @openfeature/react-sdk
3 participants