Commit dd048c3

Browse files
authored
Clean up enablePostpone Experiment (#35048)
We're not shipping this and it's a lot of code to maintain that is blocking my refactor of Fizz for SuspenseList.
1 parent c308cb5 commit dd048c3

47 files changed

Lines changed: 216 additions & 4115 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/react-client/src/ReactFlightClient.js‎

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@ import type {
3939
EncodeFormActionCallback,
4040
}from'./ReactFlightReplyClient';
4141

42-
importtype{Postpone}from'react/src/ReactPostpone';
43-
4442
importtype{TemporaryReferenceSet}from'./ReactFlightTemporaryReferences';
4543

4644
import{
47-
enablePostpone,
4845
enableProfilerTimer,
4946
enableComponentPerformanceTrack,
5047
enableAsyncDebugInfo,
@@ -89,7 +86,6 @@ import {
8986
import{
9087
REACT_LAZY_TYPE,
9188
REACT_ELEMENT_TYPE,
92-
REACT_POSTPONE_TYPE,
9389
ASYNC_ITERATOR,
9490
REACT_FRAGMENT_TYPE,
9591
}from'shared/ReactSymbols';
@@ -3460,88 +3456,6 @@ function resolveErrorDev(
34603456
return error;
34613457
}
34623458

3463-
functionresolvePostponeProd(
3464-
response: Response,
3465-
id: number,
3466-
streamState: StreamState,
3467-
): void{
3468-
if(__DEV__){
3469-
// These errors should never make it into a build so we don't need to encode them in codes.json
3470-
// eslint-disable-next-line react-internal/prod-error-codes
3471-
thrownewError(
3472-
'resolvePostponeProd should never be called in development mode. Use resolvePostponeDev instead. This is a bug in React.',
3473-
);
3474-
}
3475-
const error = new Error(
3476-
'A Server Component was postponed. The reason is omitted in production' +
3477-
' builds to avoid leaking sensitive details.',
3478-
);
3479-
const postponeInstance: Postpone = (error: any);
3480-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3481-
postponeInstance.stack = 'Error: ' + error.message;
3482-
const chunks = response._chunks;
3483-
const chunk = chunks.get(id);
3484-
if (!chunk) {
3485-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3486-
response,
3487-
postponeInstance,
3488-
);
3489-
chunks.set(id,newChunk);
3490-
} else {
3491-
triggerErrorOnChunk(response,chunk,postponeInstance);
3492-
}
3493-
}
3494-
3495-
functionresolvePostponeDev(
3496-
response: Response,
3497-
id: number,
3498-
reason: string,
3499-
stack: ReactStackTrace,
3500-
env: string,
3501-
streamState: StreamState,
3502-
): void{
3503-
if(!__DEV__){
3504-
// These errors should never make it into a build so we don't need to encode them in codes.json
3505-
// eslint-disable-next-line react-internal/prod-error-codes
3506-
thrownewError(
3507-
'resolvePostponeDev should never be called in production mode. Use resolvePostponeProd instead. This is a bug in React.',
3508-
);
3509-
}
3510-
let postponeInstance: Postpone;
3511-
const callStack = buildFakeCallStack(
3512-
response,
3513-
stack,
3514-
env,
3515-
false,
3516-
// $FlowFixMe[incompatible-use]
3517-
Error.bind(null, reason || ''),
3518-
);
3519-
const rootTask = response._debugRootTask;
3520-
if (rootTask != null) {
3521-
postponeInstance=rootTask.run(callStack);
3522-
} else {
3523-
postponeInstance=callStack();
3524-
}
3525-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3526-
const chunks = response._chunks;
3527-
const chunk = chunks.get(id);
3528-
if (!chunk) {
3529-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3530-
response,
3531-
postponeInstance,
3532-
);
3533-
if(__DEV__){
3534-
resolveChunkDebugInfo(response,streamState,newChunk);
3535-
}
3536-
chunks.set(id,newChunk);
3537-
}else{
3538-
if(__DEV__){
3539-
resolveChunkDebugInfo(response,streamState,chunk);
3540-
}
3541-
triggerErrorOnChunk(response,chunk,postponeInstance);
3542-
}
3543-
}
3544-
35453459
functionresolveErrorModel(
35463460
response: Response,
35473461
id: number,
@@ -4893,25 +4807,6 @@ function processFullStringRow(
48934807
return;
48944808
}
48954809
// Fallthrough
4896-
case80/* "P" */: {
4897-
if(enablePostpone){
4898-
if(__DEV__){
4899-
constpostponeInfo=JSON.parse(row);
4900-
resolvePostponeDev(
4901-
response,
4902-
id,
4903-
postponeInfo.reason,
4904-
postponeInfo.stack,
4905-
postponeInfo.env,
4906-
streamState,
4907-
);
4908-
}else{
4909-
resolvePostponeProd(response,id,streamState);
4910-
}
4911-
return;
4912-
}
4913-
}
4914-
// Fallthrough
49154810
default: /* """ "{" "[" "t" "f" "n" "0" - "9" */{
49164811
if(__DEV__&&row===''){
49174812
resolveDebugHalt(response,id);

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

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -90,43 +90,6 @@ describe('ReactDOMFizzForm', () => {
9090
expect(container.textContent).toEqual('Final');
9191
});
9292

93-
// @gate enablePostpone
94-
it(
95-
'if initial value postpones during hydration, it will switch to the '+
96-
'final value instead',
97-
async()=>{
98-
functionContent(){
99-
constisInitial=useDeferredValue(false,true);
100-
if(isInitial){
101-
React.unstable_postpone();
102-
}
103-
return<Texttext="Final"/>;
104-
}
105-
106-
functionApp(){
107-
return(
108-
<div>
109-
<Suspensefallback={<Texttext="Loading..."/>}>
110-
<Content/>
111-
</Suspense>
112-
</div>
113-
);
114-
}
115-
116-
conststream=awaitserverAct(()=>
117-
ReactDOMServer.renderToReadableStream(<App/>),
118-
);
119-
awaitreadIntoContainer(stream);
120-
expect(container.textContent).toEqual('Loading...');
121-
122-
assertLog(['Loading...']);
123-
// After hydration, it's updated to the final value
124-
awaitact(()=>ReactDOMClient.hydrateRoot(container,<App/>));
125-
expect(container.textContent).toEqual('Final');
126-
assertLog(['Loading...','Final']);
127-
},
128-
);
129-
13093
it(
13194
'useDeferredValue during hydration has higher priority than remaining '+
13295
'incremental hydration',

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Commit dd048c3

Browse files
authored
Clean up enablePostpone Experiment (#35048)
We're not shipping this and it's a lot of code to maintain that is blocking my refactor of Fizz for SuspenseList.
1 parent c308cb5 commit dd048c3

47 files changed

Lines changed: 216 additions & 4115 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/react-client/src/ReactFlightClient.js‎

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@ import type {
3939
EncodeFormActionCallback,
4040
}from'./ReactFlightReplyClient';
4141

42-
importtype{Postpone}from'react/src/ReactPostpone';
43-
4442
importtype{TemporaryReferenceSet}from'./ReactFlightTemporaryReferences';
4543

4644
import{
47-
enablePostpone,
4845
enableProfilerTimer,
4946
enableComponentPerformanceTrack,
5047
enableAsyncDebugInfo,
@@ -89,7 +86,6 @@ import {
8986
import{
9087
REACT_LAZY_TYPE,
9188
REACT_ELEMENT_TYPE,
92-
REACT_POSTPONE_TYPE,
9389
ASYNC_ITERATOR,
9490
REACT_FRAGMENT_TYPE,
9591
}from'shared/ReactSymbols';
@@ -3460,88 +3456,6 @@ function resolveErrorDev(
34603456
return error;
34613457
}
34623458

3463-
functionresolvePostponeProd(
3464-
response: Response,
3465-
id: number,
3466-
streamState: StreamState,
3467-
): void{
3468-
if(__DEV__){
3469-
// These errors should never make it into a build so we don't need to encode them in codes.json
3470-
// eslint-disable-next-line react-internal/prod-error-codes
3471-
thrownewError(
3472-
'resolvePostponeProd should never be called in development mode. Use resolvePostponeDev instead. This is a bug in React.',
3473-
);
3474-
}
3475-
const error = new Error(
3476-
'A Server Component was postponed. The reason is omitted in production' +
3477-
' builds to avoid leaking sensitive details.',
3478-
);
3479-
const postponeInstance: Postpone = (error: any);
3480-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3481-
postponeInstance.stack = 'Error: ' + error.message;
3482-
const chunks = response._chunks;
3483-
const chunk = chunks.get(id);
3484-
if (!chunk) {
3485-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3486-
response,
3487-
postponeInstance,
3488-
);
3489-
chunks.set(id,newChunk);
3490-
} else {
3491-
triggerErrorOnChunk(response,chunk,postponeInstance);
3492-
}
3493-
}
3494-
3495-
functionresolvePostponeDev(
3496-
response: Response,
3497-
id: number,
3498-
reason: string,
3499-
stack: ReactStackTrace,
3500-
env: string,
3501-
streamState: StreamState,
3502-
): void{
3503-
if(!__DEV__){
3504-
// These errors should never make it into a build so we don't need to encode them in codes.json
3505-
// eslint-disable-next-line react-internal/prod-error-codes
3506-
thrownewError(
3507-
'resolvePostponeDev should never be called in production mode. Use resolvePostponeProd instead. This is a bug in React.',
3508-
);
3509-
}
3510-
let postponeInstance: Postpone;
3511-
const callStack = buildFakeCallStack(
3512-
response,
3513-
stack,
3514-
env,
3515-
false,
3516-
// $FlowFixMe[incompatible-use]
3517-
Error.bind(null, reason || ''),
3518-
);
3519-
const rootTask = response._debugRootTask;
3520-
if (rootTask != null) {
3521-
postponeInstance=rootTask.run(callStack);
3522-
} else {
3523-
postponeInstance=callStack();
3524-
}
3525-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3526-
const chunks = response._chunks;
3527-
const chunk = chunks.get(id);
3528-
if (!chunk) {
3529-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3530-
response,
3531-
postponeInstance,
3532-
);
3533-
if(__DEV__){
3534-
resolveChunkDebugInfo(response,streamState,newChunk);
3535-
}
3536-
chunks.set(id,newChunk);
3537-
}else{
3538-
if(__DEV__){
3539-
resolveChunkDebugInfo(response,streamState,chunk);
3540-
}
3541-
triggerErrorOnChunk(response,chunk,postponeInstance);
3542-
}
3543-
}
3544-
35453459
functionresolveErrorModel(
35463460
response: Response,
35473461
id: number,
@@ -4893,25 +4807,6 @@ function processFullStringRow(
48934807
return;
48944808
}
48954809
// Fallthrough
4896-
case80/* "P" */: {
4897-
if(enablePostpone){
4898-
if(__DEV__){
4899-
constpostponeInfo=JSON.parse(row);
4900-
resolvePostponeDev(
4901-
response,
4902-
id,
4903-
postponeInfo.reason,
4904-
postponeInfo.stack,
4905-
postponeInfo.env,
4906-
streamState,
4907-
);
4908-
}else{
4909-
resolvePostponeProd(response,id,streamState);
4910-
}
4911-
return;
4912-
}
4913-
}
4914-
// Fallthrough
49154810
default: /* """ "{" "[" "t" "f" "n" "0" - "9" */{
49164811
if(__DEV__&&row===''){
49174812
resolveDebugHalt(response,id);

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

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -90,43 +90,6 @@ describe('ReactDOMFizzForm', () => {
9090
expect(container.textContent).toEqual('Final');
9191
});
9292

93-
// @gate enablePostpone
94-
it(
95-
'if initial value postpones during hydration, it will switch to the '+
96-
'final value instead',
97-
async()=>{
98-
functionContent(){
99-
constisInitial=useDeferredValue(false,true);
100-
if(isInitial){
101-
React.unstable_postpone();
102-
}
103-
return<Texttext="Final"/>;
104-
}
105-
106-
functionApp(){
107-
return(
108-
<div>
109-
<Suspensefallback={<Texttext="Loading..."/>}>
110-
<Content/>
111-
</Suspense>
112-
</div>
113-
);
114-
}
115-
116-
conststream=awaitserverAct(()=>
117-
ReactDOMServer.renderToReadableStream(<App/>),
118-
);
119-
awaitreadIntoContainer(stream);
120-
expect(container.textContent).toEqual('Loading...');
121-
122-
assertLog(['Loading...']);
123-
// After hydration, it's updated to the final value
124-
awaitact(()=>ReactDOMClient.hydrateRoot(container,<App/>));
125-
expect(container.textContent).toEqual('Final');
126-
assertLog(['Loading...','Final']);
127-
},
128-
);
129-
13093
it(
13194
'useDeferredValue during hydration has higher priority than remaining '+
13295
'incremental hydration',

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit dd048c3

Browse files
authored
Clean up enablePostpone Experiment (#35048)
We're not shipping this and it's a lot of code to maintain that is blocking my refactor of Fizz for SuspenseList.
1 parent c308cb5 commit dd048c3

47 files changed

Lines changed: 216 additions & 4115 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/react-client/src/ReactFlightClient.js‎

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@ import type {
3939
EncodeFormActionCallback,
4040
}from'./ReactFlightReplyClient';
4141

42-
importtype{Postpone}from'react/src/ReactPostpone';
43-
4442
importtype{TemporaryReferenceSet}from'./ReactFlightTemporaryReferences';
4543

4644
import{
47-
enablePostpone,
4845
enableProfilerTimer,
4946
enableComponentPerformanceTrack,
5047
enableAsyncDebugInfo,
@@ -89,7 +86,6 @@ import {
8986
import{
9087
REACT_LAZY_TYPE,
9188
REACT_ELEMENT_TYPE,
92-
REACT_POSTPONE_TYPE,
9389
ASYNC_ITERATOR,
9490
REACT_FRAGMENT_TYPE,
9591
}from'shared/ReactSymbols';
@@ -3460,88 +3456,6 @@ function resolveErrorDev(
34603456
return error;
34613457
}
34623458

3463-
functionresolvePostponeProd(
3464-
response: Response,
3465-
id: number,
3466-
streamState: StreamState,
3467-
): void{
3468-
if(__DEV__){
3469-
// These errors should never make it into a build so we don't need to encode them in codes.json
3470-
// eslint-disable-next-line react-internal/prod-error-codes
3471-
thrownewError(
3472-
'resolvePostponeProd should never be called in development mode. Use resolvePostponeDev instead. This is a bug in React.',
3473-
);
3474-
}
3475-
const error = new Error(
3476-
'A Server Component was postponed. The reason is omitted in production' +
3477-
' builds to avoid leaking sensitive details.',
3478-
);
3479-
const postponeInstance: Postpone = (error: any);
3480-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3481-
postponeInstance.stack = 'Error: ' + error.message;
3482-
const chunks = response._chunks;
3483-
const chunk = chunks.get(id);
3484-
if (!chunk) {
3485-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3486-
response,
3487-
postponeInstance,
3488-
);
3489-
chunks.set(id,newChunk);
3490-
} else {
3491-
triggerErrorOnChunk(response,chunk,postponeInstance);
3492-
}
3493-
}
3494-
3495-
functionresolvePostponeDev(
3496-
response: Response,
3497-
id: number,
3498-
reason: string,
3499-
stack: ReactStackTrace,
3500-
env: string,
3501-
streamState: StreamState,
3502-
): void{
3503-
if(!__DEV__){
3504-
// These errors should never make it into a build so we don't need to encode them in codes.json
3505-
// eslint-disable-next-line react-internal/prod-error-codes
3506-
thrownewError(
3507-
'resolvePostponeDev should never be called in production mode. Use resolvePostponeProd instead. This is a bug in React.',
3508-
);
3509-
}
3510-
let postponeInstance: Postpone;
3511-
const callStack = buildFakeCallStack(
3512-
response,
3513-
stack,
3514-
env,
3515-
false,
3516-
// $FlowFixMe[incompatible-use]
3517-
Error.bind(null, reason || ''),
3518-
);
3519-
const rootTask = response._debugRootTask;
3520-
if (rootTask != null) {
3521-
postponeInstance=rootTask.run(callStack);
3522-
} else {
3523-
postponeInstance=callStack();
3524-
}
3525-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3526-
const chunks = response._chunks;
3527-
const chunk = chunks.get(id);
3528-
if (!chunk) {
3529-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3530-
response,
3531-
postponeInstance,
3532-
);
3533-
if(__DEV__){
3534-
resolveChunkDebugInfo(response,streamState,newChunk);
3535-
}
3536-
chunks.set(id,newChunk);
3537-
}else{
3538-
if(__DEV__){
3539-
resolveChunkDebugInfo(response,streamState,chunk);
3540-
}
3541-
triggerErrorOnChunk(response,chunk,postponeInstance);
3542-
}
3543-
}
3544-
35453459
functionresolveErrorModel(
35463460
response: Response,
35473461
id: number,
@@ -4893,25 +4807,6 @@ function processFullStringRow(
48934807
return;
48944808
}
48954809
// Fallthrough
4896-
case80/* "P" */: {
4897-
if(enablePostpone){
4898-
if(__DEV__){
4899-
constpostponeInfo=JSON.parse(row);
4900-
resolvePostponeDev(
4901-
response,
4902-
id,
4903-
postponeInfo.reason,
4904-
postponeInfo.stack,
4905-
postponeInfo.env,
4906-
streamState,
4907-
);
4908-
}else{
4909-
resolvePostponeProd(response,id,streamState);
4910-
}
4911-
return;
4912-
}
4913-
}
4914-
// Fallthrough
49154810
default: /* """ "{" "[" "t" "f" "n" "0" - "9" */{
49164811
if(__DEV__&&row===''){
49174812
resolveDebugHalt(response,id);

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

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -90,43 +90,6 @@ describe('ReactDOMFizzForm', () => {
9090
expect(container.textContent).toEqual('Final');
9191
});
9292

93-
// @gate enablePostpone
94-
it(
95-
'if initial value postpones during hydration, it will switch to the '+
96-
'final value instead',
97-
async()=>{
98-
functionContent(){
99-
constisInitial=useDeferredValue(false,true);
100-
if(isInitial){
101-
React.unstable_postpone();
102-
}
103-
return<Texttext="Final"/>;
104-
}
105-
106-
functionApp(){
107-
return(
108-
<div>
109-
<Suspensefallback={<Texttext="Loading..."/>}>
110-
<Content/>
111-
</Suspense>
112-
</div>
113-
);
114-
}
115-
116-
conststream=awaitserverAct(()=>
117-
ReactDOMServer.renderToReadableStream(<App/>),
118-
);
119-
awaitreadIntoContainer(stream);
120-
expect(container.textContent).toEqual('Loading...');
121-
122-
assertLog(['Loading...']);
123-
// After hydration, it's updated to the final value
124-
awaitact(()=>ReactDOMClient.hydrateRoot(container,<App/>));
125-
expect(container.textContent).toEqual('Final');
126-
assertLog(['Loading...','Final']);
127-
},
128-
);
129-
13093
it(
13194
'useDeferredValue during hydration has higher priority than remaining '+
13295
'incremental hydration',

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit dd048c3

Browse files
authored
Clean up enablePostpone Experiment (#35048)
We're not shipping this and it's a lot of code to maintain that is blocking my refactor of Fizz for SuspenseList.
1 parent c308cb5 commit dd048c3

47 files changed

Lines changed: 216 additions & 4115 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/react-client/src/ReactFlightClient.js‎

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@ import type {
3939
EncodeFormActionCallback,
4040
}from'./ReactFlightReplyClient';
4141

42-
importtype{Postpone}from'react/src/ReactPostpone';
43-
4442
importtype{TemporaryReferenceSet}from'./ReactFlightTemporaryReferences';
4543

4644
import{
47-
enablePostpone,
4845
enableProfilerTimer,
4946
enableComponentPerformanceTrack,
5047
enableAsyncDebugInfo,
@@ -89,7 +86,6 @@ import {
8986
import{
9087
REACT_LAZY_TYPE,
9188
REACT_ELEMENT_TYPE,
92-
REACT_POSTPONE_TYPE,
9389
ASYNC_ITERATOR,
9490
REACT_FRAGMENT_TYPE,
9591
}from'shared/ReactSymbols';
@@ -3460,88 +3456,6 @@ function resolveErrorDev(
34603456
return error;
34613457
}
34623458

3463-
functionresolvePostponeProd(
3464-
response: Response,
3465-
id: number,
3466-
streamState: StreamState,
3467-
): void{
3468-
if(__DEV__){
3469-
// These errors should never make it into a build so we don't need to encode them in codes.json
3470-
// eslint-disable-next-line react-internal/prod-error-codes
3471-
thrownewError(
3472-
'resolvePostponeProd should never be called in development mode. Use resolvePostponeDev instead. This is a bug in React.',
3473-
);
3474-
}
3475-
const error = new Error(
3476-
'A Server Component was postponed. The reason is omitted in production' +
3477-
' builds to avoid leaking sensitive details.',
3478-
);
3479-
const postponeInstance: Postpone = (error: any);
3480-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3481-
postponeInstance.stack = 'Error: ' + error.message;
3482-
const chunks = response._chunks;
3483-
const chunk = chunks.get(id);
3484-
if (!chunk) {
3485-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3486-
response,
3487-
postponeInstance,
3488-
);
3489-
chunks.set(id,newChunk);
3490-
} else {
3491-
triggerErrorOnChunk(response,chunk,postponeInstance);
3492-
}
3493-
}
3494-
3495-
functionresolvePostponeDev(
3496-
response: Response,
3497-
id: number,
3498-
reason: string,
3499-
stack: ReactStackTrace,
3500-
env: string,
3501-
streamState: StreamState,
3502-
): void{
3503-
if(!__DEV__){
3504-
// These errors should never make it into a build so we don't need to encode them in codes.json
3505-
// eslint-disable-next-line react-internal/prod-error-codes
3506-
thrownewError(
3507-
'resolvePostponeDev should never be called in production mode. Use resolvePostponeProd instead. This is a bug in React.',
3508-
);
3509-
}
3510-
let postponeInstance: Postpone;
3511-
const callStack = buildFakeCallStack(
3512-
response,
3513-
stack,
3514-
env,
3515-
false,
3516-
// $FlowFixMe[incompatible-use]
3517-
Error.bind(null, reason || ''),
3518-
);
3519-
const rootTask = response._debugRootTask;
3520-
if (rootTask != null) {
3521-
postponeInstance=rootTask.run(callStack);
3522-
} else {
3523-
postponeInstance=callStack();
3524-
}
3525-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3526-
const chunks = response._chunks;
3527-
const chunk = chunks.get(id);
3528-
if (!chunk) {
3529-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3530-
response,
3531-
postponeInstance,
3532-
);
3533-
if(__DEV__){
3534-
resolveChunkDebugInfo(response,streamState,newChunk);
3535-
}
3536-
chunks.set(id,newChunk);
3537-
}else{
3538-
if(__DEV__){
3539-
resolveChunkDebugInfo(response,streamState,chunk);
3540-
}
3541-
triggerErrorOnChunk(response,chunk,postponeInstance);
3542-
}
3543-
}
3544-
35453459
functionresolveErrorModel(
35463460
response: Response,
35473461
id: number,
@@ -4893,25 +4807,6 @@ function processFullStringRow(
48934807
return;
48944808
}
48954809
// Fallthrough
4896-
case80/* "P" */: {
4897-
if(enablePostpone){
4898-
if(__DEV__){
4899-
constpostponeInfo=JSON.parse(row);
4900-
resolvePostponeDev(
4901-
response,
4902-
id,
4903-
postponeInfo.reason,
4904-
postponeInfo.stack,
4905-
postponeInfo.env,
4906-
streamState,
4907-
);
4908-
}else{
4909-
resolvePostponeProd(response,id,streamState);
4910-
}
4911-
return;
4912-
}
4913-
}
4914-
// Fallthrough
49154810
default: /* """ "{" "[" "t" "f" "n" "0" - "9" */{
49164811
if(__DEV__&&row===''){
49174812
resolveDebugHalt(response,id);

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

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -90,43 +90,6 @@ describe('ReactDOMFizzForm', () => {
9090
expect(container.textContent).toEqual('Final');
9191
});
9292

93-
// @gate enablePostpone
94-
it(
95-
'if initial value postpones during hydration, it will switch to the '+
96-
'final value instead',
97-
async()=>{
98-
functionContent(){
99-
constisInitial=useDeferredValue(false,true);
100-
if(isInitial){
101-
React.unstable_postpone();
102-
}
103-
return<Texttext="Final"/>;
104-
}
105-
106-
functionApp(){
107-
return(
108-
<div>
109-
<Suspensefallback={<Texttext="Loading..."/>}>
110-
<Content/>
111-
</Suspense>
112-
</div>
113-
);
114-
}
115-
116-
conststream=awaitserverAct(()=>
117-
ReactDOMServer.renderToReadableStream(<App/>),
118-
);
119-
awaitreadIntoContainer(stream);
120-
expect(container.textContent).toEqual('Loading...');
121-
122-
assertLog(['Loading...']);
123-
// After hydration, it's updated to the final value
124-
awaitact(()=>ReactDOMClient.hydrateRoot(container,<App/>));
125-
expect(container.textContent).toEqual('Final');
126-
assertLog(['Loading...','Final']);
127-
},
128-
);
129-
13093
it(
13194
'useDeferredValue during hydration has higher priority than remaining '+
13295
'incremental hydration',

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Commit dd048c3

Browse files
authored
Clean up enablePostpone Experiment (#35048)
We're not shipping this and it's a lot of code to maintain that is blocking my refactor of Fizz for SuspenseList.
1 parent c308cb5 commit dd048c3

47 files changed

Lines changed: 216 additions & 4115 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/react-client/src/ReactFlightClient.js‎

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@ import type {
3939
EncodeFormActionCallback,
4040
}from'./ReactFlightReplyClient';
4141

42-
importtype{Postpone}from'react/src/ReactPostpone';
43-
4442
importtype{TemporaryReferenceSet}from'./ReactFlightTemporaryReferences';
4543

4644
import{
47-
enablePostpone,
4845
enableProfilerTimer,
4946
enableComponentPerformanceTrack,
5047
enableAsyncDebugInfo,
@@ -89,7 +86,6 @@ import {
8986
import{
9087
REACT_LAZY_TYPE,
9188
REACT_ELEMENT_TYPE,
92-
REACT_POSTPONE_TYPE,
9389
ASYNC_ITERATOR,
9490
REACT_FRAGMENT_TYPE,
9591
}from'shared/ReactSymbols';
@@ -3460,88 +3456,6 @@ function resolveErrorDev(
34603456
return error;
34613457
}
34623458

3463-
functionresolvePostponeProd(
3464-
response: Response,
3465-
id: number,
3466-
streamState: StreamState,
3467-
): void{
3468-
if(__DEV__){
3469-
// These errors should never make it into a build so we don't need to encode them in codes.json
3470-
// eslint-disable-next-line react-internal/prod-error-codes
3471-
thrownewError(
3472-
'resolvePostponeProd should never be called in development mode. Use resolvePostponeDev instead. This is a bug in React.',
3473-
);
3474-
}
3475-
const error = new Error(
3476-
'A Server Component was postponed. The reason is omitted in production' +
3477-
' builds to avoid leaking sensitive details.',
3478-
);
3479-
const postponeInstance: Postpone = (error: any);
3480-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3481-
postponeInstance.stack = 'Error: ' + error.message;
3482-
const chunks = response._chunks;
3483-
const chunk = chunks.get(id);
3484-
if (!chunk) {
3485-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3486-
response,
3487-
postponeInstance,
3488-
);
3489-
chunks.set(id,newChunk);
3490-
} else {
3491-
triggerErrorOnChunk(response,chunk,postponeInstance);
3492-
}
3493-
}
3494-
3495-
functionresolvePostponeDev(
3496-
response: Response,
3497-
id: number,
3498-
reason: string,
3499-
stack: ReactStackTrace,
3500-
env: string,
3501-
streamState: StreamState,
3502-
): void{
3503-
if(!__DEV__){
3504-
// These errors should never make it into a build so we don't need to encode them in codes.json
3505-
// eslint-disable-next-line react-internal/prod-error-codes
3506-
thrownewError(
3507-
'resolvePostponeDev should never be called in production mode. Use resolvePostponeProd instead. This is a bug in React.',
3508-
);
3509-
}
3510-
let postponeInstance: Postpone;
3511-
const callStack = buildFakeCallStack(
3512-
response,
3513-
stack,
3514-
env,
3515-
false,
3516-
// $FlowFixMe[incompatible-use]
3517-
Error.bind(null, reason || ''),
3518-
);
3519-
const rootTask = response._debugRootTask;
3520-
if (rootTask != null) {
3521-
postponeInstance=rootTask.run(callStack);
3522-
} else {
3523-
postponeInstance=callStack();
3524-
}
3525-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3526-
const chunks = response._chunks;
3527-
const chunk = chunks.get(id);
3528-
if (!chunk) {
3529-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3530-
response,
3531-
postponeInstance,
3532-
);
3533-
if(__DEV__){
3534-
resolveChunkDebugInfo(response,streamState,newChunk);
3535-
}
3536-
chunks.set(id,newChunk);
3537-
}else{
3538-
if(__DEV__){
3539-
resolveChunkDebugInfo(response,streamState,chunk);
3540-
}
3541-
triggerErrorOnChunk(response,chunk,postponeInstance);
3542-
}
3543-
}
3544-
35453459
functionresolveErrorModel(
35463460
response: Response,
35473461
id: number,
@@ -4893,25 +4807,6 @@ function processFullStringRow(
48934807
return;
48944808
}
48954809
// Fallthrough
4896-
case80/* "P" */: {
4897-
if(enablePostpone){
4898-
if(__DEV__){
4899-
constpostponeInfo=JSON.parse(row);
4900-
resolvePostponeDev(
4901-
response,
4902-
id,
4903-
postponeInfo.reason,
4904-
postponeInfo.stack,
4905-
postponeInfo.env,
4906-
streamState,
4907-
);
4908-
}else{
4909-
resolvePostponeProd(response,id,streamState);
4910-
}
4911-
return;
4912-
}
4913-
}
4914-
// Fallthrough
49154810
default: /* """ "{" "[" "t" "f" "n" "0" - "9" */{
49164811
if(__DEV__&&row===''){
49174812
resolveDebugHalt(response,id);

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

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -90,43 +90,6 @@ describe('ReactDOMFizzForm', () => {
9090
expect(container.textContent).toEqual('Final');
9191
});
9292

93-
// @gate enablePostpone
94-
it(
95-
'if initial value postpones during hydration, it will switch to the '+
96-
'final value instead',
97-
async()=>{
98-
functionContent(){
99-
constisInitial=useDeferredValue(false,true);
100-
if(isInitial){
101-
React.unstable_postpone();
102-
}
103-
return<Texttext="Final"/>;
104-
}
105-
106-
functionApp(){
107-
return(
108-
<div>
109-
<Suspensefallback={<Texttext="Loading..."/>}>
110-
<Content/>
111-
</Suspense>
112-
</div>
113-
);
114-
}
115-
116-
conststream=awaitserverAct(()=>
117-
ReactDOMServer.renderToReadableStream(<App/>),
118-
);
119-
awaitreadIntoContainer(stream);
120-
expect(container.textContent).toEqual('Loading...');
121-
122-
assertLog(['Loading...']);
123-
// After hydration, it's updated to the final value
124-
awaitact(()=>ReactDOMClient.hydrateRoot(container,<App/>));
125-
expect(container.textContent).toEqual('Final');
126-
assertLog(['Loading...','Final']);
127-
},
128-
);
129-
13093
it(
13194
'useDeferredValue during hydration has higher priority than remaining '+
13295
'incremental hydration',

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit dd048c3

Browse files
authored
Clean up enablePostpone Experiment (#35048)
We're not shipping this and it's a lot of code to maintain that is blocking my refactor of Fizz for SuspenseList.
1 parent c308cb5 commit dd048c3

47 files changed

Lines changed: 216 additions & 4115 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/react-client/src/ReactFlightClient.js‎

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@ import type {
3939
EncodeFormActionCallback,
4040
}from'./ReactFlightReplyClient';
4141

42-
importtype{Postpone}from'react/src/ReactPostpone';
43-
4442
importtype{TemporaryReferenceSet}from'./ReactFlightTemporaryReferences';
4543

4644
import{
47-
enablePostpone,
4845
enableProfilerTimer,
4946
enableComponentPerformanceTrack,
5047
enableAsyncDebugInfo,
@@ -89,7 +86,6 @@ import {
8986
import{
9087
REACT_LAZY_TYPE,
9188
REACT_ELEMENT_TYPE,
92-
REACT_POSTPONE_TYPE,
9389
ASYNC_ITERATOR,
9490
REACT_FRAGMENT_TYPE,
9591
}from'shared/ReactSymbols';
@@ -3460,88 +3456,6 @@ function resolveErrorDev(
34603456
return error;
34613457
}
34623458

3463-
functionresolvePostponeProd(
3464-
response: Response,
3465-
id: number,
3466-
streamState: StreamState,
3467-
): void{
3468-
if(__DEV__){
3469-
// These errors should never make it into a build so we don't need to encode them in codes.json
3470-
// eslint-disable-next-line react-internal/prod-error-codes
3471-
thrownewError(
3472-
'resolvePostponeProd should never be called in development mode. Use resolvePostponeDev instead. This is a bug in React.',
3473-
);
3474-
}
3475-
const error = new Error(
3476-
'A Server Component was postponed. The reason is omitted in production' +
3477-
' builds to avoid leaking sensitive details.',
3478-
);
3479-
const postponeInstance: Postpone = (error: any);
3480-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3481-
postponeInstance.stack = 'Error: ' + error.message;
3482-
const chunks = response._chunks;
3483-
const chunk = chunks.get(id);
3484-
if (!chunk) {
3485-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3486-
response,
3487-
postponeInstance,
3488-
);
3489-
chunks.set(id,newChunk);
3490-
} else {
3491-
triggerErrorOnChunk(response,chunk,postponeInstance);
3492-
}
3493-
}
3494-
3495-
functionresolvePostponeDev(
3496-
response: Response,
3497-
id: number,
3498-
reason: string,
3499-
stack: ReactStackTrace,
3500-
env: string,
3501-
streamState: StreamState,
3502-
): void{
3503-
if(!__DEV__){
3504-
// These errors should never make it into a build so we don't need to encode them in codes.json
3505-
// eslint-disable-next-line react-internal/prod-error-codes
3506-
thrownewError(
3507-
'resolvePostponeDev should never be called in production mode. Use resolvePostponeProd instead. This is a bug in React.',
3508-
);
3509-
}
3510-
let postponeInstance: Postpone;
3511-
const callStack = buildFakeCallStack(
3512-
response,
3513-
stack,
3514-
env,
3515-
false,
3516-
// $FlowFixMe[incompatible-use]
3517-
Error.bind(null, reason || ''),
3518-
);
3519-
const rootTask = response._debugRootTask;
3520-
if (rootTask != null) {
3521-
postponeInstance=rootTask.run(callStack);
3522-
} else {
3523-
postponeInstance=callStack();
3524-
}
3525-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3526-
const chunks = response._chunks;
3527-
const chunk = chunks.get(id);
3528-
if (!chunk) {
3529-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3530-
response,
3531-
postponeInstance,
3532-
);
3533-
if(__DEV__){
3534-
resolveChunkDebugInfo(response,streamState,newChunk);
3535-
}
3536-
chunks.set(id,newChunk);
3537-
}else{
3538-
if(__DEV__){
3539-
resolveChunkDebugInfo(response,streamState,chunk);
3540-
}
3541-
triggerErrorOnChunk(response,chunk,postponeInstance);
3542-
}
3543-
}
3544-
35453459
functionresolveErrorModel(
35463460
response: Response,
35473461
id: number,
@@ -4893,25 +4807,6 @@ function processFullStringRow(
48934807
return;
48944808
}
48954809
// Fallthrough
4896-
case80/* "P" */: {
4897-
if(enablePostpone){
4898-
if(__DEV__){
4899-
constpostponeInfo=JSON.parse(row);
4900-
resolvePostponeDev(
4901-
response,
4902-
id,
4903-
postponeInfo.reason,
4904-
postponeInfo.stack,
4905-
postponeInfo.env,
4906-
streamState,
4907-
);
4908-
}else{
4909-
resolvePostponeProd(response,id,streamState);
4910-
}
4911-
return;
4912-
}
4913-
}
4914-
// Fallthrough
49154810
default: /* """ "{" "[" "t" "f" "n" "0" - "9" */{
49164811
if(__DEV__&&row===''){
49174812
resolveDebugHalt(response,id);

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

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -90,43 +90,6 @@ describe('ReactDOMFizzForm', () => {
9090
expect(container.textContent).toEqual('Final');
9191
});
9292

93-
// @gate enablePostpone
94-
it(
95-
'if initial value postpones during hydration, it will switch to the '+
96-
'final value instead',
97-
async()=>{
98-
functionContent(){
99-
constisInitial=useDeferredValue(false,true);
100-
if(isInitial){
101-
React.unstable_postpone();
102-
}
103-
return<Texttext="Final"/>;
104-
}
105-
106-
functionApp(){
107-
return(
108-
<div>
109-
<Suspensefallback={<Texttext="Loading..."/>}>
110-
<Content/>
111-
</Suspense>
112-
</div>
113-
);
114-
}
115-
116-
conststream=awaitserverAct(()=>
117-
ReactDOMServer.renderToReadableStream(<App/>),
118-
);
119-
awaitreadIntoContainer(stream);
120-
expect(container.textContent).toEqual('Loading...');
121-
122-
assertLog(['Loading...']);
123-
// After hydration, it's updated to the final value
124-
awaitact(()=>ReactDOMClient.hydrateRoot(container,<App/>));
125-
expect(container.textContent).toEqual('Final');
126-
assertLog(['Loading...','Final']);
127-
},
128-
);
129-
13093
it(
13194
'useDeferredValue during hydration has higher priority than remaining '+
13295
'incremental hydration',

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit dd048c3

Browse files
authored
Clean up enablePostpone Experiment (#35048)
We're not shipping this and it's a lot of code to maintain that is blocking my refactor of Fizz for SuspenseList.
1 parent c308cb5 commit dd048c3

47 files changed

Lines changed: 216 additions & 4115 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/react-client/src/ReactFlightClient.js‎

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@ import type {
3939
EncodeFormActionCallback,
4040
}from'./ReactFlightReplyClient';
4141

42-
importtype{Postpone}from'react/src/ReactPostpone';
43-
4442
importtype{TemporaryReferenceSet}from'./ReactFlightTemporaryReferences';
4543

4644
import{
47-
enablePostpone,
4845
enableProfilerTimer,
4946
enableComponentPerformanceTrack,
5047
enableAsyncDebugInfo,
@@ -89,7 +86,6 @@ import {
8986
import{
9087
REACT_LAZY_TYPE,
9188
REACT_ELEMENT_TYPE,
92-
REACT_POSTPONE_TYPE,
9389
ASYNC_ITERATOR,
9490
REACT_FRAGMENT_TYPE,
9591
}from'shared/ReactSymbols';
@@ -3460,88 +3456,6 @@ function resolveErrorDev(
34603456
return error;
34613457
}
34623458

3463-
functionresolvePostponeProd(
3464-
response: Response,
3465-
id: number,
3466-
streamState: StreamState,
3467-
): void{
3468-
if(__DEV__){
3469-
// These errors should never make it into a build so we don't need to encode them in codes.json
3470-
// eslint-disable-next-line react-internal/prod-error-codes
3471-
thrownewError(
3472-
'resolvePostponeProd should never be called in development mode. Use resolvePostponeDev instead. This is a bug in React.',
3473-
);
3474-
}
3475-
const error = new Error(
3476-
'A Server Component was postponed. The reason is omitted in production' +
3477-
' builds to avoid leaking sensitive details.',
3478-
);
3479-
const postponeInstance: Postpone = (error: any);
3480-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3481-
postponeInstance.stack = 'Error: ' + error.message;
3482-
const chunks = response._chunks;
3483-
const chunk = chunks.get(id);
3484-
if (!chunk) {
3485-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3486-
response,
3487-
postponeInstance,
3488-
);
3489-
chunks.set(id,newChunk);
3490-
} else {
3491-
triggerErrorOnChunk(response,chunk,postponeInstance);
3492-
}
3493-
}
3494-
3495-
functionresolvePostponeDev(
3496-
response: Response,
3497-
id: number,
3498-
reason: string,
3499-
stack: ReactStackTrace,
3500-
env: string,
3501-
streamState: StreamState,
3502-
): void{
3503-
if(!__DEV__){
3504-
// These errors should never make it into a build so we don't need to encode them in codes.json
3505-
// eslint-disable-next-line react-internal/prod-error-codes
3506-
thrownewError(
3507-
'resolvePostponeDev should never be called in production mode. Use resolvePostponeProd instead. This is a bug in React.',
3508-
);
3509-
}
3510-
let postponeInstance: Postpone;
3511-
const callStack = buildFakeCallStack(
3512-
response,
3513-
stack,
3514-
env,
3515-
false,
3516-
// $FlowFixMe[incompatible-use]
3517-
Error.bind(null, reason || ''),
3518-
);
3519-
const rootTask = response._debugRootTask;
3520-
if (rootTask != null) {
3521-
postponeInstance=rootTask.run(callStack);
3522-
} else {
3523-
postponeInstance=callStack();
3524-
}
3525-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3526-
const chunks = response._chunks;
3527-
const chunk = chunks.get(id);
3528-
if (!chunk) {
3529-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3530-
response,
3531-
postponeInstance,
3532-
);
3533-
if(__DEV__){
3534-
resolveChunkDebugInfo(response,streamState,newChunk);
3535-
}
3536-
chunks.set(id,newChunk);
3537-
}else{
3538-
if(__DEV__){
3539-
resolveChunkDebugInfo(response,streamState,chunk);
3540-
}
3541-
triggerErrorOnChunk(response,chunk,postponeInstance);
3542-
}
3543-
}
3544-
35453459
functionresolveErrorModel(
35463460
response: Response,
35473461
id: number,
@@ -4893,25 +4807,6 @@ function processFullStringRow(
48934807
return;
48944808
}
48954809
// Fallthrough
4896-
case80/* "P" */: {
4897-
if(enablePostpone){
4898-
if(__DEV__){
4899-
constpostponeInfo=JSON.parse(row);
4900-
resolvePostponeDev(
4901-
response,
4902-
id,
4903-
postponeInfo.reason,
4904-
postponeInfo.stack,
4905-
postponeInfo.env,
4906-
streamState,
4907-
);
4908-
}else{
4909-
resolvePostponeProd(response,id,streamState);
4910-
}
4911-
return;
4912-
}
4913-
}
4914-
// Fallthrough
49154810
default: /* """ "{" "[" "t" "f" "n" "0" - "9" */{
49164811
if(__DEV__&&row===''){
49174812
resolveDebugHalt(response,id);

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

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -90,43 +90,6 @@ describe('ReactDOMFizzForm', () => {
9090
expect(container.textContent).toEqual('Final');
9191
});
9292

93-
// @gate enablePostpone
94-
it(
95-
'if initial value postpones during hydration, it will switch to the '+
96-
'final value instead',
97-
async()=>{
98-
functionContent(){
99-
constisInitial=useDeferredValue(false,true);
100-
if(isInitial){
101-
React.unstable_postpone();
102-
}
103-
return<Texttext="Final"/>;
104-
}
105-
106-
functionApp(){
107-
return(
108-
<div>
109-
<Suspensefallback={<Texttext="Loading..."/>}>
110-
<Content/>
111-
</Suspense>
112-
</div>
113-
);
114-
}
115-
116-
conststream=awaitserverAct(()=>
117-
ReactDOMServer.renderToReadableStream(<App/>),
118-
);
119-
awaitreadIntoContainer(stream);
120-
expect(container.textContent).toEqual('Loading...');
121-
122-
assertLog(['Loading...']);
123-
// After hydration, it's updated to the final value
124-
awaitact(()=>ReactDOMClient.hydrateRoot(container,<App/>));
125-
expect(container.textContent).toEqual('Final');
126-
assertLog(['Loading...','Final']);
127-
},
128-
);
129-
13093
it(
13194
'useDeferredValue during hydration has higher priority than remaining '+
13295
'incremental hydration',

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Commit dd048c3

Browse files
authored
Clean up enablePostpone Experiment (#35048)
We're not shipping this and it's a lot of code to maintain that is blocking my refactor of Fizz for SuspenseList.
1 parent c308cb5 commit dd048c3

47 files changed

Lines changed: 216 additions & 4115 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/react-client/src/ReactFlightClient.js‎

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@ import type {
3939
EncodeFormActionCallback,
4040
}from'./ReactFlightReplyClient';
4141

42-
importtype{Postpone}from'react/src/ReactPostpone';
43-
4442
importtype{TemporaryReferenceSet}from'./ReactFlightTemporaryReferences';
4543

4644
import{
47-
enablePostpone,
4845
enableProfilerTimer,
4946
enableComponentPerformanceTrack,
5047
enableAsyncDebugInfo,
@@ -89,7 +86,6 @@ import {
8986
import{
9087
REACT_LAZY_TYPE,
9188
REACT_ELEMENT_TYPE,
92-
REACT_POSTPONE_TYPE,
9389
ASYNC_ITERATOR,
9490
REACT_FRAGMENT_TYPE,
9591
}from'shared/ReactSymbols';
@@ -3460,88 +3456,6 @@ function resolveErrorDev(
34603456
return error;
34613457
}
34623458

3463-
functionresolvePostponeProd(
3464-
response: Response,
3465-
id: number,
3466-
streamState: StreamState,
3467-
): void{
3468-
if(__DEV__){
3469-
// These errors should never make it into a build so we don't need to encode them in codes.json
3470-
// eslint-disable-next-line react-internal/prod-error-codes
3471-
thrownewError(
3472-
'resolvePostponeProd should never be called in development mode. Use resolvePostponeDev instead. This is a bug in React.',
3473-
);
3474-
}
3475-
const error = new Error(
3476-
'A Server Component was postponed. The reason is omitted in production' +
3477-
' builds to avoid leaking sensitive details.',
3478-
);
3479-
const postponeInstance: Postpone = (error: any);
3480-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3481-
postponeInstance.stack = 'Error: ' + error.message;
3482-
const chunks = response._chunks;
3483-
const chunk = chunks.get(id);
3484-
if (!chunk) {
3485-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3486-
response,
3487-
postponeInstance,
3488-
);
3489-
chunks.set(id,newChunk);
3490-
} else {
3491-
triggerErrorOnChunk(response,chunk,postponeInstance);
3492-
}
3493-
}
3494-
3495-
functionresolvePostponeDev(
3496-
response: Response,
3497-
id: number,
3498-
reason: string,
3499-
stack: ReactStackTrace,
3500-
env: string,
3501-
streamState: StreamState,
3502-
): void{
3503-
if(!__DEV__){
3504-
// These errors should never make it into a build so we don't need to encode them in codes.json
3505-
// eslint-disable-next-line react-internal/prod-error-codes
3506-
thrownewError(
3507-
'resolvePostponeDev should never be called in production mode. Use resolvePostponeProd instead. This is a bug in React.',
3508-
);
3509-
}
3510-
let postponeInstance: Postpone;
3511-
const callStack = buildFakeCallStack(
3512-
response,
3513-
stack,
3514-
env,
3515-
false,
3516-
// $FlowFixMe[incompatible-use]
3517-
Error.bind(null, reason || ''),
3518-
);
3519-
const rootTask = response._debugRootTask;
3520-
if (rootTask != null) {
3521-
postponeInstance=rootTask.run(callStack);
3522-
} else {
3523-
postponeInstance=callStack();
3524-
}
3525-
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
3526-
const chunks = response._chunks;
3527-
const chunk = chunks.get(id);
3528-
if (!chunk) {
3529-
constnewChunk: ErroredChunk<any>=createErrorChunk(
3530-
response,
3531-
postponeInstance,
3532-
);
3533-
if(__DEV__){
3534-
resolveChunkDebugInfo(response,streamState,newChunk);
3535-
}
3536-
chunks.set(id,newChunk);
3537-
}else{
3538-
if(__DEV__){
3539-
resolveChunkDebugInfo(response,streamState,chunk);
3540-
}
3541-
triggerErrorOnChunk(response,chunk,postponeInstance);
3542-
}
3543-
}
3544-
35453459
functionresolveErrorModel(
35463460
response: Response,
35473461
id: number,
@@ -4893,25 +4807,6 @@ function processFullStringRow(
48934807
return;
48944808
}
48954809
// Fallthrough
4896-
case80/* "P" */: {
4897-
if(enablePostpone){
4898-
if(__DEV__){
4899-
constpostponeInfo=JSON.parse(row);
4900-
resolvePostponeDev(
4901-
response,
4902-
id,
4903-
postponeInfo.reason,
4904-
postponeInfo.stack,
4905-
postponeInfo.env,
4906-
streamState,
4907-
);
4908-
}else{
4909-
resolvePostponeProd(response,id,streamState);
4910-
}
4911-
return;
4912-
}
4913-
}
4914-
// Fallthrough
49154810
default: /* """ "{" "[" "t" "f" "n" "0" - "9" */{
49164811
if(__DEV__&&row===''){
49174812
resolveDebugHalt(response,id);

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

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -90,43 +90,6 @@ describe('ReactDOMFizzForm', () => {
9090
expect(container.textContent).toEqual('Final');
9191
});
9292

93-
// @gate enablePostpone
94-
it(
95-
'if initial value postpones during hydration, it will switch to the '+
96-
'final value instead',
97-
async()=>{
98-
functionContent(){
99-
constisInitial=useDeferredValue(false,true);
100-
if(isInitial){
101-
React.unstable_postpone();
102-
}
103-
return<Texttext="Final"/>;
104-
}
105-
106-
functionApp(){
107-
return(
108-
<div>
109-
<Suspensefallback={<Texttext="Loading..."/>}>
110-
<Content/>
111-
</Suspense>
112-
</div>
113-
);
114-
}
115-
116-
conststream=awaitserverAct(()=>
117-
ReactDOMServer.renderToReadableStream(<App/>),
118-
);
119-
awaitreadIntoContainer(stream);
120-
expect(container.textContent).toEqual('Loading...');
121-
122-
assertLog(['Loading...']);
123-
// After hydration, it's updated to the final value
124-
awaitact(()=>ReactDOMClient.hydrateRoot(container,<App/>));
125-
expect(container.textContent).toEqual('Final');
126-
assertLog(['Loading...','Final']);
127-
},
128-
);
129-
13093
it(
13194
'useDeferredValue during hydration has higher priority than remaining '+
13295
'incremental hydration',

0 commit comments

Comments
 (0)