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

double invoke test #1

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
fecc288
[react devtools] Device storage support (#25452)
rbalicki2 Oct 25, 2022
1720405
[Float] fix coordination of resource identity and hydration (#25569)
gnoff Oct 27, 2022
09def59
[Float] handle noscript context for Resources (#25559)
gnoff Oct 27, 2022
28a574e
Try assigning fetch to globalThis if global assignment fails (#25571)
sebmarkbage Oct 27, 2022
cf3932b
Remove old react-fetch, react-fs and react-pg libraries (#25577)
sebmarkbage Oct 27, 2022
d2a0176
Detect and warn if use(promise) is wrapped with try/catch block (#25543)
acdlite Oct 28, 2022
5450dd4
Strict Mode: Reuse memoized result from first pass (#25583)
acdlite Oct 28, 2022
d2c0ab1
In work loop, add enum of reasons for suspending
acdlite Oct 24, 2022
952dfff
Split suspended work loop logic into separate functions
acdlite Oct 24, 2022
bdd3d08
Extract logic for detecting bad fallback to helper
acdlite Oct 24, 2022
2ac77aa
Clean up vestige of useOpaqueIdentifier (#25587)
acdlite Oct 30, 2022
765805b
Fix type check for null (#25595)
sebmarkbage Oct 31, 2022
ab075a2
Do not unmount layout effects on initial Offscreen mount (#25592)
sammy-SC Nov 1, 2022
6883d79
[ServerRenderer] Setup for adding data attributes streaming format (#…
mofeiZ Nov 1, 2022
36426e6
Allow uncached IO to stablize (#25561)
acdlite Nov 1, 2022
5f7ef8c
[Float] handle resource Resource creation inside svg context (#25599)
gnoff Nov 1, 2022
8e69bc4
Make host context use null as empty and only error in dev (#25609)
sebmarkbage Nov 1, 2022
4ea063b
refactor isHostResourceType to not receive the context from reconcile…
gnoff Nov 2, 2022
1a90262
Unwrap sync resolved thenables without suspending (#25615)
acdlite Nov 2, 2022
1a08f14
[ServerRenderer] Move fizz external runtime implementation to react-d…
mofeiZ Nov 3, 2022
df61e70
Remove check in renderDidSuspendDelayIfPossible (#25630)
acdlite Nov 3, 2022
4bd245e
Do not unmount layout effects if ancestor Offscreen is hidden (#25628)
sammy-SC Nov 4, 2022
18dff79
[DevTools] add support for HostSingleton & HostResource (#25616)
mondaychen Nov 7, 2022
1e3e30d
Fix useSyncExternalStore dropped update when state is dispatched in r…
pandaiolo Nov 8, 2022
d1e35c7
Don't disappear layout effects unnecessarily (#25660)
sammy-SC Nov 10, 2022
c54e354
[DevTools] bug fix for Hydrating fibers (#25663)
mondaychen Nov 11, 2022
e1dd0a2
Remove recoverable error when a sync update flows into a dehydrated b…
sebmarkbage Nov 16, 2022
c343f80
[react-float] feature detect getRootNode (#25689)
kassens Nov 16, 2022
355dd7d
Bump loader-utils from 2.0.0 to 2.0.4 in /fixtures/flight (#25694)
dependabot[bot] Nov 16, 2022
db8a3fc
Bump loader-utils from 1.4.0 to 1.4.2 in /fixtures/fizz (#25680)
dependabot[bot] Nov 16, 2022
d65b88d
Eagerly initialize an mutable object for instance.refs (#25696)
sebmarkbage Nov 16, 2022
07f46ec
Turn on key spread warning in jsx-runtime for everyone (#25697)
sebmarkbage Nov 16, 2022
6fb8133
Turn on string ref deprecation warning for everybody (not codemoddabl…
eps1lon Nov 17, 2022
7b17f7b
Enable warning for defaultProps on function components for everyone (…
sebmarkbage Nov 17, 2022
44c4e6f
Force unwind work loop during selective hydration (#25695)
acdlite Nov 17, 2022
9dfbd9f
use: Don't suspend if there are pending updates
acdlite Nov 3, 2022
4a2d86b
Don't reset work loop until stack is unwound
acdlite Nov 2, 2022
5eb78d0
Pass ThenableState to replaySuspendedUnitOfWork
acdlite Nov 2, 2022
4387d75
Allow more hooks to be added when replaying mount
acdlite Nov 3, 2022
33e3d28
Reuse hooks when replaying a suspended component
acdlite Nov 3, 2022
6b4c031
Check thenable instead of thenableState
acdlite Nov 3, 2022
f284d9f
Track ThenableState alongside other hooks
acdlite Nov 3, 2022
f31005d
Add SyncHydrationLane (#25698)
tyao1 Nov 17, 2022
b0a6f66
Test for double invoke effect of useLayoutEffect
kassens Nov 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ module.exports = {
'packages/react-dom/src/test-utils/**/*.js',
'packages/react-devtools-shared/**/*.js',
'packages/react-noop-renderer/**/*.js',
'packages/react-pg/**/*.js',
'packages/react-fs/**/*.js',
'packages/react-refresh/**/*.js',
'packages/react-server-dom-webpack/**/*.js',
'packages/react-test-renderer/**/*.js',
Expand Down Expand Up @@ -277,5 +275,6 @@ module.exports = {
trustedTypes: 'readonly',
IS_REACT_ACT_ENVIRONMENT: 'readonly',
AsyncLocalStorage: 'readonly',
globalThis: 'readonly',
},
};
2 changes: 1 addition & 1 deletion ReactVersions.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const stablePackages = {
// These packages do not exist in the @next or @latest channel, only
// @experimental. We don't use semver, just the commit sha, so this is just a
// list of package names instead of a map.
const experimentalPackages = ['react-fetch', 'react-fs', 'react-pg'];
const experimentalPackages = [];

module.exports = {
ReactVersion,
Expand Down
13 changes: 9 additions & 4 deletions fixtures/fizz/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3267,9 +3267,9 @@ loader-runner@^2.4.0:
integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw==

loader-utils@^1.2.3, loader-utils@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613"
integrity sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==
version "1.4.2"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.2.tgz#29a957f3a63973883eb684f10ffd3d151fec01a3"
integrity sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==
dependencies:
big.js "^5.2.2"
emojis-list "^3.0.0"
Expand Down Expand Up @@ -3460,7 +3460,12 @@ minimatch@^3.0.4:
dependencies:
brace-expansion "^1.1.7"

minimist@^1.2.0, minimist@^1.2.6:
minimist@^1.2.0:
version "1.2.7"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==

minimist@^1.2.6:
version "1.2.6"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
Expand Down
27 changes: 5 additions & 22 deletions fixtures/flight/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3192,6 +3192,7 @@ bfj@^7.0.2:
big.js@^5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==

binary-extensions@^2.0.0:
version "2.1.0"
Expand Down Expand Up @@ -6399,20 +6400,7 @@ json5@^1.0.1:
dependencies:
minimist "^1.2.0"

json5@^2.1.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.1.tgz#81b6cb04e9ba496f1c7005d07b4368a2638f90b6"
dependencies:
minimist "^1.2.0"

json5@^2.1.2:
version "2.1.3"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43"
integrity sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==
dependencies:
minimist "^1.2.5"

json5@^2.2.0, json5@^2.2.1:
json5@^2.1.0, json5@^2.1.2, json5@^2.2.0, json5@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c"
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==
Expand Down Expand Up @@ -6507,9 +6495,9 @@ loader-runner@^4.2.0:
integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==

loader-utils@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0"
integrity sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==
version "2.0.4"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.4.tgz#8b5cb38b5c34a9a018ee1fc0e6a066d1dfcc528c"
integrity sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==
dependencies:
big.js "^5.2.2"
emojis-list "^3.0.0"
Expand Down Expand Up @@ -6783,11 +6771,6 @@ minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"

minimist@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==

minimist@^1.2.6:
version "1.2.6"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,11 @@ describe('ReactHooksInspectionIntegration', () => {

await LazyFoo;

Scheduler.unstable_flushAll();
expect(() => {
Scheduler.unstable_flushAll();
}).toErrorDev([
'Foo: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.',
]);

const childFiber = renderer.root._currentFiber();
const tree = ReactDebugTools.inspectHooksOfFiber(childFiber);
Expand Down
26 changes: 26 additions & 0 deletions packages/react-devtools-core/src/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ import {initBackend} from 'react-devtools-shared/src/backend';
import {__DEBUG__} from 'react-devtools-shared/src/constants';
import setupNativeStyleEditor from 'react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor';
import {getDefaultComponentFilters} from 'react-devtools-shared/src/utils';
import {
initializeUsingCachedSettings,
cacheConsolePatchSettings,
type DevToolsSettingsManager,
} from './cachedSettings';

import type {BackendBridge} from 'react-devtools-shared/src/bridge';
import type {ComponentFilter} from 'react-devtools-shared/src/types';
Expand All @@ -29,6 +34,7 @@ type ConnectOptions = {
retryConnectionDelay?: number,
isAppActive?: () => boolean,
websocket?: ?WebSocket,
devToolsSettingsManager: ?DevToolsSettingsManager,
...
};

Expand Down Expand Up @@ -63,6 +69,7 @@ export function connectToDevTools(options: ?ConnectOptions) {
resolveRNStyle = null,
retryConnectionDelay = 2000,
isAppActive = () => true,
devToolsSettingsManager,
} = options || {};

const protocol = useHttps ? 'wss' : 'ws';
Expand All @@ -78,6 +85,16 @@ export function connectToDevTools(options: ?ConnectOptions) {
}
}

if (devToolsSettingsManager != null) {
try {
initializeUsingCachedSettings(devToolsSettingsManager);
} catch (e) {
// If we call a method on devToolsSettingsManager that throws, or if
// is invalid data read out, don't throw and don't interrupt initialization
console.error(e);
}
}

if (!isAppActive()) {
// If the app is in background, maybe retry later.
// Don't actually attempt to connect until we're in foreground.
Expand Down Expand Up @@ -142,6 +159,15 @@ export function connectToDevTools(options: ?ConnectOptions) {
},
);

if (devToolsSettingsManager != null && bridge != null) {
bridge.addListener('updateConsolePatchSettings', consolePatchSettings =>
cacheConsolePatchSettings(
devToolsSettingsManager,
consolePatchSettings,
),
);
}

// The renderer interface doesn't read saved component filters directly,
// because they are generally stored in localStorage within the context of the extension.
// Because of this it relies on the extension to pass filters.
Expand Down
77 changes: 77 additions & 0 deletions packages/react-devtools-core/src/cachedSettings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

import {
type ConsolePatchSettings,
writeConsolePatchSettingsToWindow,
} from 'react-devtools-shared/src/backend/console';
import {castBool, castBrowserTheme} from 'react-devtools-shared/src/utils';

// Note: all keys should be optional in this type, because users can use newer
// versions of React DevTools with older versions of React Native, and the object
// provided by React Native may not include all of this type's fields.
export type DevToolsSettingsManager = {
getConsolePatchSettings: ?() => string,
setConsolePatchSettings: ?(key: string) => void,
};

export function initializeUsingCachedSettings(
devToolsSettingsManager: DevToolsSettingsManager,
) {
initializeConsolePatchSettings(devToolsSettingsManager);
}

function initializeConsolePatchSettings(
devToolsSettingsManager: DevToolsSettingsManager,
) {
if (devToolsSettingsManager.getConsolePatchSettings == null) {
return;
}
const consolePatchSettingsString = devToolsSettingsManager.getConsolePatchSettings();
if (consolePatchSettingsString == null) {
return;
}
const parsedConsolePatchSettings = parseConsolePatchSettings(
consolePatchSettingsString,
);
if (parsedConsolePatchSettings == null) {
return;
}
writeConsolePatchSettingsToWindow(parsedConsolePatchSettings);
}

function parseConsolePatchSettings(
consolePatchSettingsString: string,
): ?ConsolePatchSettings {
const parsedValue = JSON.parse(consolePatchSettingsString ?? '{}');
const {
appendComponentStack,
breakOnConsoleErrors,
showInlineWarningsAndErrors,
hideConsoleLogsInStrictMode,
browserTheme,
} = parsedValue;
return {
appendComponentStack: castBool(appendComponentStack) ?? true,
breakOnConsoleErrors: castBool(breakOnConsoleErrors) ?? false,
showInlineWarningsAndErrors: castBool(showInlineWarningsAndErrors) ?? true,
hideConsoleLogsInStrictMode: castBool(hideConsoleLogsInStrictMode) ?? false,
browserTheme: castBrowserTheme(browserTheme) ?? 'dark',
};
}

export function cacheConsolePatchSettings(
devToolsSettingsManager: DevToolsSettingsManager,
value: ConsolePatchSettings,
): void {
if (devToolsSettingsManager.setConsolePatchSettings == null) {
return;
}
devToolsSettingsManager.setConsolePatchSettings(JSON.stringify(value));
}
Loading