Skip to content

Fix observeFragment triggering unhandled rejections on network error #4885

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

Closed

Conversation

XiNiHa
Copy link
Contributor

@XiNiHa XiNiHa commented Jan 20, 2025

This PR fixes an issue where observeFragment triggers unhandled rejections on network error, which happens because of the dangling promise created and dropped.

@captbaritone
Copy link
Contributor

Thanks for the PR. Is it possible to construct a regression test?

@XiNiHa XiNiHa force-pushed the observefragment-unhandled-rejection branch 2 times, most recently from b83c4fd to ed1f78d Compare January 22, 2025 06:20
@XiNiHa
Copy link
Contributor Author

XiNiHa commented Jan 22, 2025

Thanks for the PR. Is it possible to construct a regression test?

You can now switch to 4e2c53a and see the test failing :)

btw, while working on the test, I realized that the current behavior is somewhat unnatural since it doesn't notify the observer at all when network errors occur. While I also think that it's inappropriate to return network errors from fragment observation, I believe it should fallback to returning missing data at least 🤔

@captbaritone
Copy link
Contributor

Good catch that we don't model query errors as fragment errors. Given that's existing behavior, maybe we can tackle that as a second PR. Mind opening an issue?

@facebook-github-bot
Copy link
Contributor

@captbaritone has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@XiNiHa XiNiHa force-pushed the observefragment-unhandled-rejection branch from ed1f78d to 77c906e Compare January 23, 2025 03:10
@XiNiHa
Copy link
Contributor Author

XiNiHa commented Jan 23, 2025

Good catch that we don't model query errors as fragment errors. Given that's existing behavior, maybe we can tackle that as a second PR. Mind opening an issue?

#4888

@captbaritone
Copy link
Contributor

I've run into an issue merging this due to subtle differences in how Jest works internally vs here in open source. I'm working to resolve that issue.

@facebook-github-bot
Copy link
Contributor

@captbaritone merged this pull request in 10073c8.

@XiNiHa XiNiHa deleted the observefragment-unhandled-rejection branch January 31, 2025 03:08
XiNiHa added a commit to XiNiHa/solid-relay that referenced this pull request Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants