Visitar URL original
Fix `observeFragment` triggering unhandled rejections on network error by XiNiHa · Pull Request #4885 · meta/relay · GitHub
Skip to content

Fix observeFragment triggering unhandled rejections on network error - #4885

Closed
XiNiHa wants to merge 2 commits into
meta:mainfrom
XiNiHa:observefragment-unhandled-rejection
Closed

XiNiHa wants to merge 2 commits into
meta:mainfrom
XiNiHa:observefragment-unhandled-rejection

Conversation

@XiNiHa

@XiNiHa XiNiHa commented Jan 20, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

XiNiHa commented Jan 22, 2025

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
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

XiNiHa commented Jan 23, 2025

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
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