GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remove unstable_changedBits (#20953) · react/react@6d3ecb7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • react-cache/src
      • ReactCacheOld.js
    • react-debug-tools/src
      • ReactDebugHooks.js
    • react-devtools-shared/src/devtools
      • cache.js
    • react-dom/src
      • __tests__
        • ReactDOMServerIntegrationHooks-test.js
        • ReactDOMServerIntegrationNewContext-test.js
      • server
        • ReactPartialRendererHooks.js
    • react-reconciler/src
      • ReactFiberBeginWork.new.js
      • ReactFiberBeginWork.old.js
      • ReactFiberCacheComponent.new.js
      • ReactFiberCacheComponent.old.js
      • ReactFiberHooks.new.js
      • ReactFiberHooks.old.js
      • ReactFiberNewContext.new.js
      • ReactFiberNewContext.old.js
      • ReactInternalTypes.js
      • __tests__
        • ReactNewContext-test.js
    • react/src
      • ReactContext.js
      • ReactHooks.js
    • shared
      • ReactTypes.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-cache/src/ReactCacheOld.js‎

Copy file name to clipboardExpand all lines: packages/react-cache/src/ReactCacheOld.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const ReactCurrentDispatcher =
4646
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
4747
.ReactCurrentDispatcher;
4848

49-
function readContext(Context, observedBits) {
49+
function readContext(Context) {
5050
const dispatcher = ReactCurrentDispatcher.current;
5151
if (dispatcher === null) {
5252
throw new Error(
@@ -55,7 +55,7 @@ function readContext(Context, observedBits) {
5555
'lifecycle methods.',
5656
);
5757
}
58-
return dispatcher.readContext(Context, observedBits);
58+
return dispatcher.readContext(Context);
5959
}
6060

6161
function identityHashFn(input) {
Collapse file

‎packages/react-debug-tools/src/ReactDebugHooks.js‎

Copy file name to clipboardExpand all lines: packages/react-debug-tools/src/ReactDebugHooks.js
+2-8Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,12 @@ function getCacheForType<T>(resourceType: () => T): T {
109109
invariant(false, 'Not implemented.');
110110
}
111111

112-
function readContext<T>(
113-
context: ReactContext<T>,
114-
observedBits: void | number | boolean,
115-
): T {
112+
function readContext<T>(context: ReactContext<T>): T {
116113
// For now we don't expose readContext usage in the hooks debugging info.
117114
return context._currentValue;
118115
}
119116

120-
function useContext<T>(
121-
context: ReactContext<T>,
122-
observedBits: void | number | boolean,
123-
): T {
117+
function useContext<T>(context: ReactContext<T>): T {
124118
hookLog.push({
125119
primitive: 'Context',
126120
stackError: new Error(),
Collapse file

‎packages/react-devtools-shared/src/devtools/cache.js‎

Copy file name to clipboardExpand all lines: packages/react-devtools-shared/src/devtools/cache.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const Rejected = 2;
6161
const ReactCurrentDispatcher = (React: any)
6262
.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
6363

64-
function readContext(Context, observedBits) {
64+
function readContext(Context) {
6565
const dispatcher = ReactCurrentDispatcher.current;
6666
if (dispatcher === null) {
6767
throw new Error(
@@ -70,7 +70,7 @@ function readContext(Context, observedBits) {
7070
'lifecycle methods.',
7171
);
7272
}
73-
return dispatcher.readContext(Context, observedBits);
73+
return dispatcher.readContext(Context);
7474
}
7575

7676
const CacheContext = createContext(null);
Collapse file

‎packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.js‎

Copy file name to clipboardExpand all lines: packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.js
+2-13Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -736,17 +736,6 @@ describe('ReactDOMServerHooks', () => {
736736
},
737737
);
738738

739-
itRenders('warns when bitmask is passed to useContext', async render => {
740-
const Context = React.createContext('Hi');
741-
742-
function Foo() {
743-
return <span>{useContext(Context, 1)}</span>;
744-
}
745-
746-
const domNode = await render(<Foo />, 1);
747-
expect(domNode.textContent).toBe('Hi');
748-
});
749-
750739
describe('useDebugValue', () => {
751740
itRenders('is a noop', async render => {
752741
function Counter(props) {
@@ -760,11 +749,11 @@ describe('ReactDOMServerHooks', () => {
760749
});
761750

762751
describe('readContext', () => {
763-
function readContext(Context, observedBits) {
752+
function readContext(Context) {
764753
const dispatcher =
765754
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
766755
.ReactCurrentDispatcher.current;
767-
return dispatcher.readContext(Context, observedBits);
756+
return dispatcher.readContext(Context);
768757
}
769758

770759
itRenders(
Collapse file

‎packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js‎

Copy file name to clipboardExpand all lines: packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ describe('ReactDOMServerIntegration', () => {
161161
});
162162

163163
itRenders('readContext() in different components', async render => {
164-
function readContext(Ctx, observedBits) {
164+
function readContext(Ctx) {
165165
const dispatcher =
166166
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
167167
.ReactCurrentDispatcher.current;
168-
return dispatcher.readContext(Ctx, observedBits);
168+
return dispatcher.readContext(Ctx);
169169
}
170170

171171
class Cls extends React.Component {
Collapse file

‎packages/react-dom/src/server/ReactPartialRendererHooks.js‎

Copy file name to clipboardExpand all lines: packages/react-dom/src/server/ReactPartialRendererHooks.js
+2-8Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,7 @@ function getCacheForType<T>(resourceType: () => T): T {
219219
invariant(false, 'Not implemented.');
220220
}
221221

222-
function readContext<T>(
223-
context: ReactContext<T>,
224-
observedBits: void | number | boolean,
225-
): T {
222+
function readContext<T>(context: ReactContext<T>): T {
226223
const threadID = currentPartialRenderer.threadID;
227224
validateContextBounds(context, threadID);
228225
if (__DEV__) {
@@ -238,10 +235,7 @@ function readContext<T>(
238235
return context[threadID];
239236
}
240237

241-
function useContext<T>(
242-
context: ReactContext<T>,
243-
observedBits: void | number | boolean,
244-
): T {
238+
function useContext<T>(context: ReactContext<T>): T {
245239
if (__DEV__) {
246240
currentHookNameInDev = 'useContext';
247241
}
Collapse file

‎packages/react-reconciler/src/ReactFiberBeginWork.new.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberBeginWork.new.js
+6-23Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ import {
160160
checkIfContextChanged,
161161
readContext,
162162
prepareToReadContext,
163-
calculateChangedBits,
164163
scheduleWorkOnParentPath,
165164
} from './ReactFiberNewContext.new';
166165
import {renderWithHooks, bailoutHooks} from './ReactFiberHooks.new';
@@ -221,7 +220,7 @@ import {
221220
restoreSpawnedCachePool,
222221
getOffscreenDeferredCachePool,
223222
} from './ReactFiberCacheComponent.new';
224-
import {MAX_SIGNED_31_BIT_INT} from './MaxInts';
223+
import is from 'shared/objectIs';
225224

226225
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
227226

@@ -795,12 +794,7 @@ function updateCacheComponent(
795794
pushCacheProvider(workInProgress, nextCache);
796795
if (nextCache !== prevState.cache) {
797796
// This cache refreshed. Propagate a context change.
798-
propagateContextChange(
799-
workInProgress,
800-
CacheContext,
801-
MAX_SIGNED_31_BIT_INT,
802-
renderLanes,
803-
);
797+
propagateContextChange(workInProgress, CacheContext, renderLanes);
804798
}
805799
}
806800
}
@@ -1169,12 +1163,7 @@ function updateHostRoot(current, workInProgress, renderLanes) {
11691163
pushCacheProvider(workInProgress, nextCache);
11701164
if (nextCache !== prevState.cache) {
11711165
// The root cache refreshed.
1172-
propagateContextChange(
1173-
workInProgress,
1174-
CacheContext,
1175-
MAX_SIGNED_31_BIT_INT,
1176-
renderLanes,
1177-
);
1166+
propagateContextChange(workInProgress, CacheContext, renderLanes);
11781167
}
11791168
}
11801169

@@ -3011,8 +3000,7 @@ function updateContextProvider(
30113000
} else {
30123001
if (oldProps !== null) {
30133002
const oldValue = oldProps.value;
3014-
const changedBits = calculateChangedBits(context, newValue, oldValue);
3015-
if (changedBits === 0) {
3003+
if (is(oldValue, newValue)) {
30163004
// No change. Bailout early if children are the same.
30173005
if (
30183006
oldProps.children === newProps.children &&
@@ -3027,12 +3015,7 @@ function updateContextProvider(
30273015
} else {
30283016
// The context value changed. Search for matching consumers and schedule
30293017
// them to update.
3030-
propagateContextChange(
3031-
workInProgress,
3032-
context,
3033-
changedBits,
3034-
renderLanes,
3035-
);
3018+
propagateContextChange(workInProgress, context, renderLanes);
30363019
}
30373020
}
30383021
}
@@ -3090,7 +3073,7 @@ function updateContextConsumer(
30903073
}
30913074

30923075
prepareToReadContext(workInProgress, renderLanes);
3093-
const newValue = readContext(context, newProps.unstable_observedBits);
3076+
const newValue = readContext(context);
30943077
let newChildren;
30953078
if (__DEV__) {
30963079
ReactCurrentOwner.current = workInProgress;
Collapse file

‎packages/react-reconciler/src/ReactFiberBeginWork.old.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberBeginWork.old.js
+6-23Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ import {
160160
checkIfContextChanged,
161161
readContext,
162162
prepareToReadContext,
163-
calculateChangedBits,
164163
scheduleWorkOnParentPath,
165164
} from './ReactFiberNewContext.old';
166165
import {renderWithHooks, bailoutHooks} from './ReactFiberHooks.old';
@@ -221,7 +220,7 @@ import {
221220
restoreSpawnedCachePool,
222221
getOffscreenDeferredCachePool,
223222
} from './ReactFiberCacheComponent.old';
224-
import {MAX_SIGNED_31_BIT_INT} from './MaxInts';
223+
import is from 'shared/objectIs';
225224

226225
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
227226

@@ -795,12 +794,7 @@ function updateCacheComponent(
795794
pushCacheProvider(workInProgress, nextCache);
796795
if (nextCache !== prevState.cache) {
797796
// This cache refreshed. Propagate a context change.
798-
propagateContextChange(
799-
workInProgress,
800-
CacheContext,
801-
MAX_SIGNED_31_BIT_INT,
802-
renderLanes,
803-
);
797+
propagateContextChange(workInProgress, CacheContext, renderLanes);
804798
}
805799
}
806800
}
@@ -1169,12 +1163,7 @@ function updateHostRoot(current, workInProgress, renderLanes) {
11691163
pushCacheProvider(workInProgress, nextCache);
11701164
if (nextCache !== prevState.cache) {
11711165
// The root cache refreshed.
1172-
propagateContextChange(
1173-
workInProgress,
1174-
CacheContext,
1175-
MAX_SIGNED_31_BIT_INT,
1176-
renderLanes,
1177-
);
1166+
propagateContextChange(workInProgress, CacheContext, renderLanes);
11781167
}
11791168
}
11801169

@@ -3011,8 +3000,7 @@ function updateContextProvider(
30113000
} else {
30123001
if (oldProps !== null) {
30133002
const oldValue = oldProps.value;
3014-
const changedBits = calculateChangedBits(context, newValue, oldValue);
3015-
if (changedBits === 0) {
3003+
if (is(oldValue, newValue)) {
30163004
// No change. Bailout early if children are the same.
30173005
if (
30183006
oldProps.children === newProps.children &&
@@ -3027,12 +3015,7 @@ function updateContextProvider(
30273015
} else {
30283016
// The context value changed. Search for matching consumers and schedule
30293017
// them to update.
3030-
propagateContextChange(
3031-
workInProgress,
3032-
context,
3033-
changedBits,
3034-
renderLanes,
3035-
);
3018+
propagateContextChange(workInProgress, context, renderLanes);
30363019
}
30373020
}
30383021
}
@@ -3090,7 +3073,7 @@ function updateContextConsumer(
30903073
}
30913074

30923075
prepareToReadContext(workInProgress, renderLanes);
3093-
const newValue = readContext(context, newProps.unstable_observedBits);
3076+
const newValue = readContext(context);
30943077
let newChildren;
30953078
if (__DEV__) {
30963079
ReactCurrentOwner.current = workInProgress;
Collapse file

‎packages/react-reconciler/src/ReactFiberCacheComponent.new.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberCacheComponent.new.js
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export const CacheContext: ReactContext<Cache> = enableCache
3737
// We don't use Consumer/Provider for Cache components. So we'll cheat.
3838
Consumer: (null: any),
3939
Provider: (null: any),
40-
_calculateChangedBits: null,
4140
// We'll initialize these at the root.
4241
_currentValue: (null: any),
4342
_currentValue2: (null: any),
Collapse file

‎packages/react-reconciler/src/ReactFiberCacheComponent.old.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberCacheComponent.old.js
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export const CacheContext: ReactContext<Cache> = enableCache
3737
// We don't use Consumer/Provider for Cache components. So we'll cheat.
3838
Consumer: (null: any),
3939
Provider: (null: any),
40-
_calculateChangedBits: null,
4140
// We'll initialize these at the root.
4241
_currentValue: (null: any),
4342
_currentValue2: (null: any),

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.