Skip to content

refactor: data source for errors and warnings tracking is now in Store#31010

Merged
hoxyq merged 1 commit into
react:mainfrom
hoxyq:react-devtools/refactor-ui-for-elements-and-errors-tracking
Sep 24, 2024
Merged

refactor: data source for errors and warnings tracking is now in Store#31010
hoxyq merged 1 commit into
react:mainfrom
hoxyq:react-devtools/refactor-ui-for-elements-and-errors-tracking

Conversation

@hoxyq

@hoxyq hoxyq commented Sep 20, 2024

Copy link
Copy Markdown
Contributor

Stacked on #31009.

  1. Instead of keeping showInlineWarningsAndErrors in Settings context (which was removed in refactor[react-devtools]: propagate settings from global hook object to frontend #30610), Store will now have a boolean flag, which controls if the UI should be displaying information about errors and warnings.
  2. The errors and warnings counters in the Tree view are now counting only unique errors. This makes more sense, because it is part of the Elements Tree view, so ideally it should be showing number of components with errors and number of components of warnings. Consider this example:
    2.1. Warning for element A was emitted once and warning for element B was emitted twice.
    2.2. With previous implementation, we would show 3 ⚠️, because in total there were 3 warnings in total. If user tries to iterate through these, it will only take 2 steps to do the full cycle, because there are only 2 elements with warnings (with one having same warning, which was emitted twice).
    2.3 With current implementation, we would show 2 ⚠️. Inspecting the element with doubled warning will still show the warning counter (2) before the warning message.

With these changes, the feature correctly works.
https://fburl.com/a7fw92m4

@hoxyq hoxyq requested a review from vzaidman September 20, 2024 12:31
@vercel

vercel Bot commented Sep 20, 2024

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 24, 2024 4:56pm

@EdmondChuiHW EdmondChuiHW left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. The new way def makes more sense to navigate. I'll leave the naming decision at your discretion.

Comment on lines +117 to +118
_cachedUniqueErrorCount: number = 0;
_cachedUniqueWarningCount: number = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit on naming: "unique" isn't really accurate, i.e. in the example from PR desc, every error can still be different, even if they originate from the same component.

If I understand the PR example correctly, it's a "count of components with any [errors/warnings]".

Maybe we can pick a concise version of the following?

Suggested change
_cachedUniqueErrorCount: number = 0;
_cachedUniqueWarningCount: number = 0;
_cachedComponentWithAnyErrorCount: number = 0;
_cachedComponentWIthAnyWarningCount: number = 0;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that makes more sense, let me change that

@hoxyq hoxyq force-pushed the react-devtools/refactor-ui-for-elements-and-errors-tracking branch from 404011c to 06ca431 Compare September 24, 2024 16:54
@hoxyq hoxyq merged commit a15bbe1 into react:main Sep 24, 2024
@hoxyq hoxyq deleted the react-devtools/refactor-ui-for-elements-and-errors-tracking branch September 24, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants