GeezerVison is showing github.com — Fixed invalid DevTools work tags (#20362) · react/react@a2a0255
File treeExpand file treeCollapse file tree Open diff view settings react-devtools-shared/src/backend
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: package.json +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 106 | 106 | }, | 107 | 107 | "scripts": { | 108 | 108 | "build": "node ./scripts/rollup/build.js", | 109 | | - "build-for-devtools-dev": "cross-env RELEASE_CHANNEL=experimental yarn build react/index,react-dom/index,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh --type=NODE_DEV", | 110 | | - "build-for-devtools-prod": "cross-env RELEASE_CHANNEL=experimental yarn build react/index,react-dom/index,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh --type=NODE_PROD", | | 109 | + "build-for-devtools-dev": "cross-env RELEASE_CHANNEL=experimental yarn build react/index,react-dom,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh --type=NODE_DEV", | | 110 | + "build-for-devtools-prod": "cross-env RELEASE_CHANNEL=experimental yarn build react/index,react-dom,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh --type=NODE_PROD", | 111 | 111 | "linc": "node ./scripts/tasks/linc.js", | 112 | 112 | "lint": "node ./scripts/tasks/eslint.js", | 113 | 113 | "lint-build": "node ./scripts/rollup/validate/index.js", | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-art/package.json +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | { | 2 | 2 | "name": "react-art", | 3 | 3 | "description": "React ART is a JavaScript library for drawing vector graphics using React. It provides declarative and reactive bindings to the ART library. Using the same declarative API you can render the output to either Canvas, SVG or VML (IE8).", | 4 | | - "version": "17.0.1", | | 4 | + "version": "17.0.2", | 5 | 5 | "main": "index.js", | 6 | 6 | "repository": { | 7 | 7 | "type": "git", | | 29 | 29 | "scheduler": "^0.20.1" | 30 | 30 | }, | 31 | 31 | "peerDependencies": { | 32 | | - "react": "17.0.1" | | 32 | + "react": "17.0.2" | 33 | 33 | }, | 34 | 34 | "files": [ | 35 | 35 | "LICENSE", | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-devtools-shared/src/backend/renderer.js +65-6Lines changed: 65 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 7 | 7 | * @flow | 8 | 8 | */ | 9 | 9 |
| 10 | | -import {gte} from 'semver'; | | 10 | +import {gt, gte} from 'semver'; | 11 | 11 | import { | 12 | 12 | ComponentFilterDisplayName, | 13 | 13 | ComponentFilterElementType, | @@ -166,8 +166,10 @@ export function getInternalReactConstants( | 166 | 166 | // ********************************************************** | 167 | 167 | // The section below is copied from files in React repo. | 168 | 168 | // Keep it in sync, and add version guards if it changes. | 169 | | - if (gte(version, '17.0.0-alpha')) { | 170 | | - // TODO (Offscreen) Update the version number above to reflect the first Offscreen alpha/beta release. | | 169 | + // | | 170 | + // TODO Update the gt() check below to be gte() whichever the next version number is. | | 171 | + // Currently the version in Git is 17.0.2 (but that version has not been/may not end up being released). | | 172 | + if (gt(version, '17.0.1')) { | 171 | 173 | ReactTypeOfWork = { | 172 | 174 | ClassComponent: 1, | 173 | 175 | ContextConsumer: 9, | @@ -185,10 +187,41 @@ export function getInternalReactConstants( | 185 | 187 | IncompleteClassComponent: 17, | 186 | 188 | IndeterminateComponent: 2, | 187 | 189 | LazyComponent: 16, | | 190 | + LegacyHiddenComponent: 23, | 188 | 191 | MemoComponent: 14, | 189 | 192 | Mode: 8, | 190 | 193 | OffscreenComponent: 22, // Experimental | 191 | 194 | Profiler: 12, | | 195 | + ScopeComponent: 21, // Experimental | | 196 | + SimpleMemoComponent: 15, | | 197 | + SuspenseComponent: 13, | | 198 | + SuspenseListComponent: 19, // Experimental | | 199 | + YieldComponent: -1, // Removed | | 200 | + }; | | 201 | + } else if (gte(version, '17.0.0-alpha')) { | | 202 | + ReactTypeOfWork = { | | 203 | + ClassComponent: 1, | | 204 | + ContextConsumer: 9, | | 205 | + ContextProvider: 10, | | 206 | + CoroutineComponent: -1, // Removed | | 207 | + CoroutineHandlerPhase: -1, // Removed | | 208 | + DehydratedSuspenseComponent: 18, // Behind a flag | | 209 | + ForwardRef: 11, | | 210 | + Fragment: 7, | | 211 | + FunctionComponent: 0, | | 212 | + HostComponent: 5, | | 213 | + HostPortal: 4, | | 214 | + HostRoot: 3, | | 215 | + HostText: 6, | | 216 | + IncompleteClassComponent: 17, | | 217 | + IndeterminateComponent: 2, | | 218 | + LazyComponent: 16, | | 219 | + LegacyHiddenComponent: 24, | | 220 | + MemoComponent: 14, | | 221 | + Mode: 8, | | 222 | + OffscreenComponent: 23, // Experimental | | 223 | + Profiler: 12, | | 224 | + ScopeComponent: 21, // Experimental | 192 | 225 | SimpleMemoComponent: 15, | 193 | 226 | SuspenseComponent: 13, | 194 | 227 | SuspenseListComponent: 19, // Experimental | @@ -212,10 +245,12 @@ export function getInternalReactConstants( | 212 | 245 | IncompleteClassComponent: 17, | 213 | 246 | IndeterminateComponent: 2, | 214 | 247 | LazyComponent: 16, | | 248 | + LegacyHiddenComponent: -1, | 215 | 249 | MemoComponent: 14, | 216 | 250 | Mode: 8, | 217 | 251 | OffscreenComponent: -1, // Experimental | 218 | 252 | Profiler: 12, | | 253 | + ScopeComponent: -1, // Experimental | 219 | 254 | SimpleMemoComponent: 15, | 220 | 255 | SuspenseComponent: 13, | 221 | 256 | SuspenseListComponent: 19, // Experimental | @@ -239,10 +274,12 @@ export function getInternalReactConstants( | 239 | 274 | IncompleteClassComponent: -1, // Doesn't exist yet | 240 | 275 | IndeterminateComponent: 4, | 241 | 276 | LazyComponent: -1, // Doesn't exist yet | | 277 | + LegacyHiddenComponent: -1, | 242 | 278 | MemoComponent: -1, // Doesn't exist yet | 243 | 279 | Mode: 10, | 244 | 280 | OffscreenComponent: -1, // Experimental | 245 | 281 | Profiler: 15, | | 282 | + ScopeComponent: -1, // Experimental | 246 | 283 | SimpleMemoComponent: -1, // Doesn't exist yet | 247 | 284 | SuspenseComponent: 16, | 248 | 285 | SuspenseListComponent: -1, // Doesn't exist yet | @@ -266,10 +303,12 @@ export function getInternalReactConstants( | 266 | 303 | IncompleteClassComponent: -1, // Doesn't exist yet | 267 | 304 | IndeterminateComponent: 0, | 268 | 305 | LazyComponent: -1, // Doesn't exist yet | | 306 | + LegacyHiddenComponent: -1, | 269 | 307 | MemoComponent: -1, // Doesn't exist yet | 270 | 308 | Mode: 11, | 271 | 309 | OffscreenComponent: -1, // Experimental | 272 | 310 | Profiler: 15, | | 311 | + ScopeComponent: -1, // Experimental | 273 | 312 | SimpleMemoComponent: -1, // Doesn't exist yet | 274 | 313 | SuspenseComponent: 16, | 275 | 314 | SuspenseListComponent: -1, // Doesn't exist yet | @@ -301,7 +340,11 @@ export function getInternalReactConstants( | 301 | 340 | HostPortal, | 302 | 341 | HostText, | 303 | 342 | Fragment, | | 343 | + LazyComponent, | | 344 | + LegacyHiddenComponent, | 304 | 345 | MemoComponent, | | 346 | + OffscreenComponent, | | 347 | + ScopeComponent, | 305 | 348 | SimpleMemoComponent, | 306 | 349 | SuspenseComponent, | 307 | 350 | SuspenseListComponent, | @@ -354,11 +397,22 @@ export function getInternalReactConstants( | 354 | 397 | case HostText: | 355 | 398 | case Fragment: | 356 | 399 | return null; | | 400 | + case LazyComponent: | | 401 | + // This display name will not be user visible. | | 402 | + // Once a Lazy component loads its inner component, React replaces the tag and type. | | 403 | + // This display name will only show up in console logs when DevTools DEBUG mode is on. | | 404 | + return 'Lazy'; | 357 | 405 | case MemoComponent: | 358 | 406 | case SimpleMemoComponent: | 359 | 407 | return getDisplayName(resolvedType, 'Anonymous'); | 360 | 408 | case SuspenseComponent: | 361 | 409 | return 'Suspense'; | | 410 | + case LegacyHiddenComponent: | | 411 | + return 'LegacyHidden'; | | 412 | + case OffscreenComponent: | | 413 | + return 'Offscreen'; | | 414 | + case ScopeComponent: | | 415 | + return 'Scope'; | 362 | 416 | case SuspenseListComponent: | 363 | 417 | return 'SuspenseList'; | 364 | 418 | default: | @@ -493,10 +547,14 @@ export function attach( | 493 | 547 |
| 494 | 548 | const debug = (name: string, fiber: Fiber, parentFiber: ?Fiber): void => { | 495 | 549 | if (__DEBUG__) { | 496 | | - const displayName = getDisplayNameForFiber(fiber) || 'null'; | | 550 | + const displayName = | | 551 | + fiber.tag + ':' + (getDisplayNameForFiber(fiber) || 'null'); | 497 | 552 | const id = getFiberID(fiber); | 498 | | - const parentDisplayName = | 499 | | - (parentFiber != null && getDisplayNameForFiber(parentFiber)) || 'null'; | | 553 | + const parentDisplayName = parentFiber | | 554 | + ? parentFiber.tag + | | 555 | + ':' + | | 556 | + (getDisplayNameForFiber(parentFiber) || 'null') | | 557 | + : ''; | 500 | 558 | const parentID = parentFiber ? getFiberID(parentFiber) : ''; | 501 | 559 | // NOTE: calling getFiberID or getPrimaryFiber is unsafe here | 502 | 560 | // because it will put them in the map. For now, we'll omit them. | @@ -1207,6 +1265,7 @@ export function attach( | 1207 | 1265 | return; | 1208 | 1266 | } | 1209 | 1267 | const id = getFiberID(primaryFiber); | | 1268 | + | 1210 | 1269 | if (isRoot) { | 1211 | 1270 | // Roots must be removed only after all children (pending and simulated) have been removed. | 1212 | 1271 | // So we track it separately. | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-devtools-shared/src/backend/types.js +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -42,10 +42,12 @@ export type WorkTagMap = {| | 42 | 42 | IncompleteClassComponent: WorkTag, | 43 | 43 | IndeterminateComponent: WorkTag, | 44 | 44 | LazyComponent: WorkTag, | | 45 | + LegacyHiddenComponent: WorkTag, | 45 | 46 | MemoComponent: WorkTag, | 46 | 47 | Mode: WorkTag, | 47 | 48 | OffscreenComponent: WorkTag, | 48 | 49 | Profiler: WorkTag, | | 50 | + ScopeComponent: WorkTag, | 49 | 51 | SimpleMemoComponent: WorkTag, | 50 | 52 | SuspenseComponent: WorkTag, | 51 | 53 | SuspenseListComponent: WorkTag, | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/package.json +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | { | 2 | 2 | "name": "react-dom", | 3 | | - "version": "17.0.1", | | 3 | + "version": "17.0.2", | 4 | 4 | "description": "React package for working with the DOM.", | 5 | 5 | "main": "index.js", | 6 | 6 | "repository": { | | 22 | 22 | "scheduler": "^0.20.1" | 23 | 23 | }, | 24 | 24 | "peerDependencies": { | 25 | | - "react": "17.0.1" | | 25 | + "react": "17.0.2" | 26 | 26 | }, | 27 | 27 | "files": [ | 28 | 28 | "LICENSE", | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-is/package.json +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | { | 2 | 2 | "name": "react-is", | 3 | | - "version": "17.0.1", | | 3 | + "version": "17.0.2", | 4 | 4 | "description": "Brand checking of React Elements.", | 5 | 5 | "main": "index.js", | 6 | 6 | "repository": { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/package.json +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 26 | 26 | "node": ">=0.10.0" | 27 | 27 | }, | 28 | 28 | "peerDependencies": { | 29 | | - "react": "^17.0.1" | | 29 | + "react": "^17.0.2" | 30 | 30 | }, | 31 | 31 | "dependencies": { | 32 | 32 | "loose-envify": "^1.1.0", | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-test-renderer/package.json +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | { | 2 | 2 | "name": "react-test-renderer", | 3 | | - "version": "17.0.1", | | 3 | + "version": "17.0.2", | 4 | 4 | "description": "React package for snapshot testing.", | 5 | 5 | "main": "index.js", | 6 | 6 | "repository": { | | 20 | 20 | "homepage": "https://reactjs.org/", | 21 | 21 | "dependencies": { | 22 | 22 | "object-assign": "^4.1.1", | 23 | | - "react-is": "^17.0.1", | | 23 | + "react-is": "^17.0.2", | 24 | 24 | "react-shallow-renderer": "^16.13.1", | 25 | 25 | "scheduler": "^0.20.1" | 26 | 26 | }, | 27 | 27 | "peerDependencies": { | 28 | | - "react": "17.0.1" | | 28 | + "react": "17.0.2" | 29 | 29 | }, | 30 | 30 | "files": [ | 31 | 31 | "LICENSE", | |
Collapse file Copy file name to clipboardExpand all lines: packages/react/package.json +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 | "keywords": [ | 5 | 5 | "react" | 6 | 6 | ], | 7 | | - "version": "17.0.1", | | 7 | + "version": "17.0.2", | 8 | 8 | "homepage": "https://reactjs.org/", | 9 | 9 | "bugs": "https://github.com/facebook/react/issues", | 10 | 10 | "license": "MIT", | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/ReactVersion.js +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 | */ | 7 | 7 |
| 8 | 8 | // TODO: this is special because it gets imported during build. | 9 | | -export default '17.0.1'; | | 9 | +// | | 10 | +// TODO: 17.0.2 has not been released to NPM; | | 11 | +// It exists as a placeholder so that DevTools can support work tag changes between releases. | | 12 | +// When we next publish a release (either 17.0.2 or 17.1.0), update the matching TODO in backend/renderer.js | | 13 | +export default '17.0.2'; |
|