microsoft / microsoft/applicationinsights-react-js
AppInsightsErrorBoundary: option to clear hasError (e.g. when using browser back)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 47
- Forks
- 18
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 8
Description
Is your feature request related to a problem? Please describe.
I am using the AppInsightsErrorBoundary in App.tsx to display an error page when an error occurs somewhere in the application. This works well. However, when I click the browser back button to return to the previous page, the error component is rendered again. This can only be resolved with a page reload. It seems like the hasError state within the AppInsightsErrorBoundary can never be false.
Describe the solution you'd like
I would like to have the option to toggle the hasError state from the outside or have the AppInsightsErrorBoundary automatically set it to false after rendering.
Describe alternatives you've considered
I tried setting the key attribute of the AppInsightsErrorBoundary to location.pathname to trigger a re-render when the location changes, but it had no effect.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading AppInsightsErrorBoundary and its usage in App.tsx, focusing on how the hasError state is set and retained across navigation. Done means the boundary can recover when returning to a previous page, either through an externally controlled reset or the requested automatic behavior; the issue does not name a test file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend, observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100