Skip to content

Commit a1414c2

Browse files
committed
Remove canViewSource flag
This is unnecessary. It's implied by the source field being not null.
1 parent 02e5266 commit a1414c2

6 files changed

Lines changed: 1 addition & 17 deletions

File tree

packages/react-devtools-shared/src/__tests__/__serializers__/inspectedElementSerializer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ export function test(maybeInspectedElement) {
1515
hasOwnProperty('canEditFunctionProps') &&
1616
hasOwnProperty('canEditHooks') &&
1717
hasOwnProperty('canToggleSuspense') &&
18-
hasOwnProperty('canToggleError') &&
19-
hasOwnProperty('canViewSource')
18+
hasOwnProperty('canToggleError')
2019
);
2120
}
2221

packages/react-devtools-shared/src/backend/fiber/renderer.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4374,8 +4374,6 @@ export function attach(
43744374
(fiber.alternate !== null &&
43754375
forceFallbackForFibers.has(fiber.alternate))),
43764376

4377-
// Can view component source location.
4378-
canViewSource,
43794377
source,
43804378

43814379
// Does the component have legacy context attached to it.
@@ -4416,7 +4414,6 @@ export function attach(
44164414
function inspectVirtualInstanceRaw(
44174415
virtualInstance: VirtualInstance,
44184416
): InspectedElement | null {
4419-
const canViewSource = true;
44204417
const source = getSourceForInstance(virtualInstance);
44214418

44224419
const componentInfo = virtualInstance.data;
@@ -4470,8 +4467,6 @@ export function attach(
44704467

44714468
canToggleSuspense: supportsTogglingSuspense && hasSuspenseBoundary,
44724469

4473-
// Can view component source location.
4474-
canViewSource,
44754470
source,
44764471

44774472
// Does the component have legacy context attached to it.

packages/react-devtools-shared/src/backend/legacy/renderer.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,8 +830,6 @@ export function attach(
830830
// Suspense did not exist in legacy versions
831831
canToggleSuspense: false,
832832

833-
// Can view component source location.
834-
canViewSource: type === ElementTypeClass || type === ElementTypeFunction,
835833
source: null,
836834

837835
// Only legacy context exists in legacy versions.

packages/react-devtools-shared/src/backend/types.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,6 @@ export type InspectedElement = {
264264
// Is this Suspense, and can its value be overridden now?
265265
canToggleSuspense: boolean,
266266

267-
// Can view component source location.
268-
canViewSource: boolean,
269-
270267
// Does the component have legacy context attached to it.
271268
hasLegacyContext: boolean,
272269

packages/react-devtools-shared/src/backendAPI.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ export function convertInspectedElementBackendToFrontend(
222222
canToggleError,
223223
isErrored,
224224
canToggleSuspense,
225-
canViewSource,
226225
hasLegacyContext,
227226
id,
228227
type,
@@ -252,7 +251,6 @@ export function convertInspectedElementBackendToFrontend(
252251
canToggleError,
253252
isErrored,
254253
canToggleSuspense,
255-
canViewSource,
256254
hasLegacyContext,
257255
id,
258256
key,

packages/react-devtools-shared/src/frontend/types.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,6 @@ export type InspectedElement = {
227227
// Is this Suspense, and can its value be overridden now?
228228
canToggleSuspense: boolean,
229229

230-
// Can view component source location.
231-
canViewSource: boolean,
232-
233230
// Does the component have legacy context attached to it.
234231
hasLegacyContext: boolean,
235232

0 commit comments

Comments
 (0)