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(makeServerFetchye): mask errors from server side fetching #49

Merged
merged 3 commits into from
Jul 23, 2021

Conversation

code-forger
Copy link
Member

When a fetch fails in SSR, we now drop the error entirely. This prevents unserializable Errors ending up in the redux store.

This also provides a better behaviour for SSR where failed fetches still render a loading state, allowing the browser to 'try again' fetching the data

Motivation and Context

This removes a 'cannot serialize' error from being emitted on the server when a fetch fails.

How Has This Been Tested?

Using a local instance of one app and some test modules I have proved that SSR now renders a 'loading' state of the application, without logging 'cannot serialize' errors, when a fetch fails in the server.
I have Unit test coverage for all new code.

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (adding or updating documentation)
  • Dependency update

Checklist:

  • My change requires a change to the documentation and I have updated the documentation accordingly.
  • My changes are in sync with the code style of this project.
  • There aren't any other open Pull Requests for the same issue/update.
  • These changes should be applied to a maintenance branch.
  • I have added the Apache 2.0 license header to any new files created.

What is the Impact to Developers Using Fetchye?

None

@code-forger code-forger requested review from a team as code owners July 20, 2021 13:01
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 20, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 2e59af6:

Sandbox Source
quick-install Configuration
fetchye-provider-install Configuration
fetchye-redux-provider-install Configuration
nextjs-fetchye-ssr Configuration

JAdshead
JAdshead previously approved these changes Jul 20, 2021
Copy link
Contributor

@JAdshead JAdshead left a comment

Choose a reason for hiding this comment

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

I am happy to always have another attempt in the client if it errors on the server.

packages/fetchye-core/__tests__/ssrFetcher.spec.js Outdated Show resolved Hide resolved
packages/fetchye-core/src/ssrFetcher.js Outdated Show resolved Hide resolved
packages/fetchye-core/__tests__/ssrFetcher.spec.js Outdated Show resolved Hide resolved
@JAdshead JAdshead merged commit 3503836 into main Jul 23, 2021
@JAdshead JAdshead deleted the fix/ssr-errors branch July 23, 2021 17:29
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.

None yet

3 participants