Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve first render white screen issue (#1482) #1797

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ workflows:
- build
filters:
branches:
only: master
only: fix/1482-first-render-issue
11 changes: 11 additions & 0 deletions public/_headers
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Cache-Control: no-cache

/static/*
Cache-Control: public, max-age=31536000, immutable

/*.js
Cache-Control: public, max-age=31536000, immutable

/*.css
Cache-Control: public, max-age=31536000, immutable
2 changes: 1 addition & 1 deletion public/_redirects
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/* /index.html 200
/* /index.html 200
22 changes: 14 additions & 8 deletions sw-precache-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ function mapImagesToGlobs(boards, globPrefix) {
}
});
});
console.log(
globs.forEach(glob => {
console.log(glob);
})
);
return globs;
}

Expand All @@ -29,11 +24,21 @@ module.exports = {
staticFileGlobs: [
'build/*.html',
'build/manifest.json',
'build/static/**/!(*map*)',
'build/static/**/*.*',
...boardImages
],
maximumFileSizeToCacheInBytes: 4194304,
runtimeCaching: [
{
urlPattern: /\/static\//,
handler: 'cacheFirst',
options: {
cache: {
name: 'static-assets',
maxEntries: 200
}
}
},
{
urlPattern: /\/symbols\/mulberry/,
handler: 'cacheFirst',
Expand Down Expand Up @@ -62,10 +67,11 @@ module.exports = {
}
}
],
dontCacheBustUrlsMatching: /\.\w{8}\./,
navigateFallback: '/index.html',
navigateFallbackWhitelist: [/^\/(?!api).*/],
dontCacheBustUrlsMatching: /\.(js|css|json|jpg|jpeg|png|svg|ico)$/,
dynamicUrlToDependencies: {
'/': ['build/index.html']
},
navigateFallback: '/',
swFilePath: 'build/service-worker.js'
};
Loading