Skip to content

Commit c815194

Browse files
colbatayusharma
authored andcommitted
Remove prefetch for async components (#132)
* Removes prefetch for the components mounted asynchronously. * Updates changelog
1 parent 3fd5d6d commit c815194

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## master
22
- Do not log warning for component first emission in `melody-streams` in production [#128](https://github.com/trivago/melody/pull/128)
3+
- Removes prefetch for asynchronously mounted components [#129](https://github.com/trivago/melody/issues/129)
34

45
## 1.2.0
56

packages/melody-compiler/__tests__/__snapshots__/CompilerSpec.js.snap

+6-6
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@ _template.render = function (_context) {
16051605
foo: \\"bar\\"
16061606
});
16071607
component(AsyncComponent, \\"bar\\", {
1608-
promisedComponent: () => import( /* webpackChunkName: \\"bar\\", webpackPrefetch: true */\\"foo.twig\\"),
1608+
promisedComponent: () => import( /* webpackChunkName: \\"bar\\" */\\"foo.twig\\"),
16091609
delayLoadingAnimation: 0,
16101610
whileLoading: () => {
16111611
text(\\" Loading... \\");
@@ -1620,7 +1620,7 @@ _template.render = function (_context) {
16201620
}
16211621
});
16221622
component(AsyncComponent, \\"bar\\", {
1623-
promisedComponent: () => import( /* webpackChunkName: \\"bar\\", webpackPrefetch: true */\\"foo.twig\\"),
1623+
promisedComponent: () => import( /* webpackChunkName: \\"bar\\" */\\"foo.twig\\"),
16241624
delayLoadingAnimation: 500,
16251625
whileLoading: () => {
16261626
text(\\" Loading... \\");
@@ -1635,7 +1635,7 @@ _template.render = function (_context) {
16351635
}
16361636
});
16371637
component(AsyncComponent, \\"bar\\", {
1638-
promisedComponent: () => import( /* webpackChunkName: \\"bar\\", webpackPrefetch: true */\\"foo.twig\\"),
1638+
promisedComponent: () => import( /* webpackChunkName: \\"bar\\" */\\"foo.twig\\"),
16391639
delayLoadingAnimation: 1000,
16401640
whileLoading: () => {
16411641
text(\\" Loading... \\");
@@ -1651,7 +1651,7 @@ _template.render = function (_context) {
16511651
}
16521652
});
16531653
component(AsyncComponent, \\"\\" + (\\"bar-\\" + _context.part), {
1654-
promisedComponent: () => import( /* webpackPrefetch: true */\\"./parts/\\" + _context.part + \\".twig\\"),
1654+
promisedComponent: () => import( /* */\\"./parts/\\" + _context.part + \\".twig\\"),
16551655
delayLoadingAnimation: 1000,
16561656
whileLoading: () => {
16571657
text(\\" Loading... \\");
@@ -1666,7 +1666,7 @@ _template.render = function (_context) {
16661666
}
16671667
});
16681668
component(AsyncComponent, \\"bar\\", {
1669-
promisedComponent: () => import( /* webpackChunkName: \\"bar\\", webpackPrefetch: true */\\"./parts/\\" + _context.part + \\".twig\\"),
1669+
promisedComponent: () => import( /* webpackChunkName: \\"bar\\" */\\"./parts/\\" + _context.part + \\".twig\\"),
16701670
delayLoadingAnimation: 1000,
16711671
whileLoading: () => {
16721672
text(\\" Loading... \\");
@@ -1677,7 +1677,7 @@ _template.render = function (_context) {
16771677
}
16781678
});
16791679
component(AsyncComponent, \\"bar\\", {
1680-
promisedComponent: () => import( /* webpackChunkName: \\"bar\\", webpackPrefetch: true */\\"./parts/\\" + _context.part + \\".twig\\"),
1680+
promisedComponent: () => import( /* webpackChunkName: \\"bar\\" */\\"./parts/\\" + _context.part + \\".twig\\"),
16811681
delayLoadingAnimation: 1000,
16821682
whileLoading: () => {
16831683
elementOpen(\\"strong\\", null, null);

packages/melody-plugin-idom/src/visitors/mount.js

-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ export default {
108108
}
109109

110110
if (isAsync) {
111-
/* webpackPrefetch: true */
112111
const source = path.node.source;
113112

114113
source.leadingComments = [
@@ -120,7 +119,6 @@ export default {
120119
args[args.length - 1].value
121120
}"`
122121
: '',
123-
'webpackPrefetch: true',
124122
]
125123
.filter(Boolean)
126124
.join(', ')} `,

0 commit comments

Comments
 (0)