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 — Cache react-fetch results in the Node version (#20407) · react/react@b9680ae

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/react-fetch/src
    • ReactFetchNode.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-fetch/src/ReactFetchNode.js‎

Copy file name to clipboardExpand all lines: packages/react-fetch/src/ReactFetchNode.js
+12-3Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ function Response(nativeResponse) {
100100
this.url = nativeResponse.url;
101101

102102
this._response = nativeResponse;
103-
this._blob = null;
104103
this._json = null;
105104
this._text = null;
106105

@@ -151,12 +150,22 @@ Response.prototype = {
151150
throw new Error('Not implemented.');
152151
},
153152
json() {
153+
if (this._json !== null) {
154+
return this._json;
155+
}
154156
const buffer = readResult(this._result);
155-
return JSON.parse(buffer.toString());
157+
const json = JSON.parse(buffer.toString());
158+
this._json = json;
159+
return json;
156160
},
157161
text() {
162+
if (this._text !== null) {
163+
return this._text;
164+
}
158165
const buffer = readResult(this._result);
159-
return buffer.toString();
166+
const text = buffer.toString();
167+
this._text = text;
168+
return text;
160169
},
161170
};
162171

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.