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

FED-193 Show Component Name in ErrorBoundary Stack #770

Merged
merged 8 commits into from
Aug 3, 2022

Conversation

joebingham-wk
Copy link
Contributor

@joebingham-wk joebingham-wk commented Jul 27, 2022

Motivation

Error boundaries show a minified version of a class component's name when an error is caught in production. This PR adds a fix, making it so the component's name should be shown in the stack trace of the error boundary.

Changes

  • Update the builder to override the displayName property on class based components
  • Remove the component's display name being set in the registerComponent2 function
  • Add an example showing that the name shows in the stack
  • Add tests

Release Notes

Review

See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.

Please review:

QA Checklist

  • Tests were updated and provide good coverage of the changeset and other affected code
  • Manual testing was performed if needed
    • Steps from PR author:
      • Use the example to verify the component's name shows in the stack as expected
    • Anything falling under manual testing criteria outlined in CONTRIBUTING.md

Merge Checklist

While we perform many automated checks before auto-merging, some manual checks are needed:

  • A Client Platform member has reviewed these changes
  • There are no unaddressed comments - this check can be automated if reviewers use the "Request Changes" feature
  • For release PRs - Version metadata in Rosie comment is correct

@aviary2-wf
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on Slack: #support-infosec.

@joebingham-wk joebingham-wk marked this pull request as ready for review July 27, 2022 18:59
@joebingham-wk joebingham-wk requested review from a team and brianphillips-wk and removed request for a team July 27, 2022 18:59
Copy link
Contributor

@greglittlefield-wf greglittlefield-wf left a comment

Choose a reason for hiding this comment

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

This looks awesome! Just a couple minor things

@@ -68,10 +68,6 @@ ReactDartComponentFactoryProxy2 registerComponent2(react.Component2 Function() d
bridgeFactory: UiComponent2BridgeImpl.bridgeFactory,
);

if (displayName != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since displayName parameter is no longer used, can we deprecate it, and update the builder to no longer pass it in the generated registerComponent2 call?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed! I was planning on leaving registerComponent alone since that whole stack is deprecated, but I ended up updating that too to avoid unnecessary conditional logic in the builder!

test/over_react/component/error_boundary_prod_test.dart Outdated Show resolved Hide resolved
test/over_react/component/error_boundary_prod_test.dart Outdated Show resolved Hide resolved
Copy link
Contributor

@greglittlefield-wf greglittlefield-wf left a comment

Choose a reason for hiding this comment

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

+10

@Workiva/release-management-p

Copy link

@rmconsole-wf rmconsole-wf left a comment

Choose a reason for hiding this comment

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

+1 from RM

@rmconsole5-wk rmconsole5-wk merged commit c80c257 into master Aug 3, 2022
@rmconsole5-wk rmconsole5-wk deleted the FED-193-error-boundary-stack branch August 3, 2022 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants