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: LoadableComponentErrorBoundary should be used in prod, not in dev #1429

Merged
merged 2 commits into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ way to update this template, but currently, we follow a pattern:

## Upcoming version 2020-XX-XX

- [fix] LoadableComponentErrorBoundary should be used in prod, not in dev-mode with
hot-loading.[#1429](https://github.com/sharetribe/ftw-daily/pull/1429)
- [fix] currency for Poland (PLN) [#1427](https://github.com/sharetribe/ftw-daily/pull/1427)

## [v8.1.0] 2021-03-11
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import React, { Component } from 'react';

import config from '../../config';

import { LoadableComponentErrorBoundaryPage } from './LoadableComponentErrorBoundaryPage';

// Use ErrorBoyndary to catch ChunkLoadError
Expand All @@ -23,4 +26,16 @@ class LoadableComponentErrorBoundary extends Component {
}
}

export default LoadableComponentErrorBoundary;
// LoadableComponentErrorBoundary helps in situations
// where production build changes in the server and
// long-living client app tries to fetch code chunks that don't exist anymore.
// Note: in development mode with Hot Module Reloading (HMR) in use, this causes error loops.
const UseLoadableErrorBoundaryOnlyInProdutionMode = props => {
const { children } = props;
return config.dev ? (
children
) : (
<LoadableComponentErrorBoundary>{children}</LoadableComponentErrorBoundary>
);
};
export default UseLoadableErrorBoundaryOnlyInProdutionMode;