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

Live resolvers: return value when throw #4877

Open
pavelglac opened this issue Jan 9, 2025 · 1 comment
Open

Live resolvers: return value when throw #4877

pavelglac opened this issue Jan 9, 2025 · 1 comment

Comments

@pavelglac
Copy link

pavelglac commented Jan 9, 2025

Return value when resolvers throw

Based on the docs :

If an individual resolver throws an error, when that field is read, Relay will log that error to the environment's user-provided relayFieldLogger logger, and the field will become null.

I am assuming the return value for resolvers should be null instead of the current undefined. However, tests for react-relay mark undefined as the expected value.

The fix would be to also save the return value from evaluation in LiveResolverCache.js
and not only the snapshot and error.

PR with suggested changes: #4876

@alloy
Copy link
Contributor

alloy commented Jan 9, 2025

Perhaps good to note that this result changed between Relay v17 and v18.

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

No branches or pull requests

2 participants