Skip to content

Commit

Permalink
Merge pull request #1429 from sharetribe/fix-loadablecomponenterrorbo…
Browse files Browse the repository at this point in the history
…undary

Fix: LoadableComponentErrorBoundary should be used in prod, not in dev
  • Loading branch information
Gnito authored Apr 9, 2021
2 parents 85e9291 + f9a199e commit 495ff08
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
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;

0 comments on commit 495ff08

Please sign in to comment.