Skip to content

Commit bfad414

Browse files
Rework prefetch to avoid updating store slices (#178)
* Rework prefetch to avoid updating store slices * Fix strict promise check
1 parent 327f66e commit bfad414

File tree

20 files changed

+507
-280
lines changed

20 files changed

+507
-280
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ yarn.lock
88
.local
99
.idea
1010
.vscode
11-
src/webpack/__tests__/__fixtures__/webpack/output
11+
src/webpack/__tests__/__fixtures__/webpack/output
12+
.DS_Store

examples/routing-with-resources/home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const Home = () => {
2626
<ul>
2727
{breeds.slice(0, 25).map(breed => (
2828
<li key={breed}>
29-
<Link to={aboutRoute} query={{ name: breed }}>
29+
<Link to={aboutRoute} query={{ name: breed }} prefetch="hover">
3030
{breed}
3131
</Link>
3232
</li>

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
},
5151
"scripts": {
5252
"build": "npm run build:clean && npm run build:types-cjs && npm run build:types-esm && npm run build:cjs && npm run build:esm",
53-
"build:cjs": "babel src --out-dir build/cjs --extensions \".ts,.tsx\" --source-maps inline --ignore src/__tests__ --presets @babel/env",
53+
"build:cjs": "babel src --out-dir build/cjs --extensions \".ts,.tsx\" --ignore src/__tests__ --presets @babel/env",
5454
"build:clean": "rm -rf ./build",
55-
"build:esm": "babel src --out-dir build/esm --extensions \".ts,.tsx\" --source-maps inline --ignore src/__tests__",
55+
"build:esm": "babel src --out-dir build/esm --extensions \".ts,.tsx\" --ignore src/__tests__",
5656
"build:types-cjs": "tsc --emitDeclarationOnly --project tsconfig.build.json --outDir build/cjs && cp src/*.flow build/cjs",
5757
"build:types-esm": "tsc --emitDeclarationOnly --project tsconfig.build.json --outDir build/esm && cp src/*.flow build/esm",
5858
"docs": "npx docsify-cli serve docs",

src/__tests__/integration/test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ describe('<Router /> integration tests', () => {
226226
},
227227
},
228228
executing: null,
229+
prefetching: null,
229230
});
230231
});
231232
});

src/__tests__/unit/common/utils/history/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ describe('createLegacyHistory', () => {
121121
const history = createLegacyHistory();
122122
history.push(null as any);
123123
expect(spy).toHaveBeenCalledWith('/');
124-
})
124+
});
125125

126126
it('should change location via page reload', async () => {
127127
const history = createLegacyHistory();
@@ -144,7 +144,7 @@ describe('createLegacyHistory', () => {
144144
const history = createLegacyHistory();
145145
history.replace(null as any);
146146
expect(window.history.replaceState).toHaveBeenCalledWith({}, '', '/');
147-
})
147+
});
148148

149149
it('should replace location via history', () => {
150150
window.history.replaceState = jest.fn();

0 commit comments

Comments
 (0)