Skip to content

Commit

Permalink
improve full refresh overlay (#33301)
Browse files Browse the repository at this point in the history
include a few lines of stack trace in the full refresh overlay
error is not necessary webpack related



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
  • Loading branch information
sokra committed Jan 14, 2022
1 parent fd231a6 commit 30ca6b3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion packages/next/client/dev/error-overlay/hot-dev-client.js
Expand Up @@ -330,7 +330,12 @@ const FULL_REFRESH_STORAGE_KEY = '_has_warned_about_full_refresh'
function performFullRefresh(err) {
if (shouldWarnAboutFullRefresh()) {
sessionStorage.setItem(FULL_REFRESH_STORAGE_KEY, 'true')
onFullRefreshNeeded(err.message)
const reason =
err &&
((err.stack && err.stack.split('\n').slice(0, 5).join('\n')) ||
err.message ||
err + '')
onFullRefreshNeeded(reason)
} else {
window.location.reload()
}
Expand Down
2 changes: 1 addition & 1 deletion packages/next/compiled/@next/react-dev-overlay/client.js

Large diffs are not rendered by default.

Expand Up @@ -109,7 +109,7 @@ const FullRefreshWarningReason = ({
component, which disables Fast Refresh. Fast Refresh requires at least
one parent function component in your React tree.
</p>
<p>You can find more information in the related Webpack error below:</p>
<p>You can find more information in the related error below:</p>
<Terminal content={reason} />
</>
)
Expand Down

0 comments on commit 30ca6b3

Please sign in to comment.