Skip to content

Commit 4c5117f

Browse files
committed
deploy: 0b2f639
1 parent c942b5c commit 4c5117f

File tree

23 files changed

+132
-70
lines changed

23 files changed

+132
-70
lines changed

assets/default-project/en.zip

0 Bytes
Binary file not shown.

assets/sample-projects/HTML5.zip

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

assets/sample-projects/explore.zip

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

cacheManifest.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"assets/default-project/en.zip": "68b441b1de1e16b68193e2d7bb46c41d",
2+
"assets/default-project/en.zip": "d236d401d4d47d07f2353c054ce3c0a9",
33
"assets/default-project/en/images/cloud1.svg": "aca7bba84a2237f1c1988caea54a67a9",
44
"assets/default-project/en/images/cloud2.svg": "02880216ac461f1578ac8a18f158ce28",
55
"assets/default-project/en/images/cloud3.svg": "7a78bb29bd895ead8c171001244d9b7d",
@@ -114,7 +114,7 @@
114114
"assets/phoenix-splash/no-preview.html": "e62c3e83f0dfa1abb595e8e4ad67ff92",
115115
"assets/phoenix-splash/safari.html": "dbe3e156bb436b14f4c41888b5d1f2cf",
116116
"assets/phoenix-splash/styles.css": "6779a4e26a1f27a64035c8b67f9ce729",
117-
"assets/sample-projects/bootstrap-blog.zip": "70dd2d1e595d2d87b2a409260f763b57",
117+
"assets/sample-projects/bootstrap-blog.zip": "437f25c20207a421aeeb6b8993e6aa03",
118118
"assets/sample-projects/bootstrap-blog/assets/brand/bootstrap-logo-white.svg": "2e642df55357162ad28519305c8fd4fe",
119119
"assets/sample-projects/bootstrap-blog/assets/brand/bootstrap-logo.svg": "88eef7f3c2bcf988457a0e6d123c3f1d",
120120
"assets/sample-projects/bootstrap-blog/assets/dist/css/bootstrap.min.css": "6d9c6fda1e7087224431cc8068bb998f",
@@ -124,7 +124,7 @@
124124
"assets/sample-projects/bootstrap-blog/blog.rtl.css": "c6c275bf0b804d3dec264ec7fb3d7677",
125125
"assets/sample-projects/bootstrap-blog/index-rtl.html": "506e2d3fd1c4bb3651377144a62d5e82",
126126
"assets/sample-projects/bootstrap-blog/index.html": "dd8824ad3c9520dc0a825176d20eb694",
127-
"assets/sample-projects/dashboard.zip": "586f4594084ec5766eebb789d290ab0d",
127+
"assets/sample-projects/dashboard.zip": "0a58c14eb4a73675cce4689bebc0cd4b",
128128
"assets/sample-projects/dashboard/assets/brand/bootstrap-logo-white.svg": "2e642df55357162ad28519305c8fd4fe",
129129
"assets/sample-projects/dashboard/assets/brand/bootstrap-logo.svg": "88eef7f3c2bcf988457a0e6d123c3f1d",
130130
"assets/sample-projects/dashboard/assets/dist/css/bootstrap.min.css": "6d9c6fda1e7087224431cc8068bb998f",
@@ -136,7 +136,7 @@
136136
"assets/sample-projects/dashboard/index.html": "ddfda6ea9dfc8e12a8dcbbf065c804de",
137137
"assets/sample-projects/dashboard/signin.css": "a71ff2b493f230e0d6585793c2115809",
138138
"assets/sample-projects/dashboard/signin.html": "b108c183dfa7e2da3d88ec79bee79509",
139-
"assets/sample-projects/explore.zip": "73a7c4da18663569b1d101e5649c474c",
139+
"assets/sample-projects/explore.zip": "6cfbfeeee03d30a1b04a6faef7f0c7d6",
140140
"assets/sample-projects/explore/A-tribute-page.html": "007699e85177db3d1cd87d0d47440b36",
141141
"assets/sample-projects/explore/adjustable-fireworks.html": "706a0995d00d8ae009b5426cf7ee69be",
142142
"assets/sample-projects/explore/ant_colony.html": "d0885229e57caecc83049b50ee98560c",
@@ -226,7 +226,7 @@
226226
"assets/sample-projects/explore/watermelon-pixel.html": "6f6754e8073436bb823807a10a0446ea",
227227
"assets/sample-projects/explore/webmine.html": "9879458a48c757dc6671d408e940da4d",
228228
"assets/sample-projects/explore/whack-a-mole.html": "827f15c53657350b9c898fa27ecf15ac",
229-
"assets/sample-projects/home-pages.zip": "7c44f495df0d975aa32b1cad489465e4",
229+
"assets/sample-projects/home-pages.zip": "fc3106c41d491b2bee95899a4bdfcc29",
230230
"assets/sample-projects/home-pages/album/index.html": "df20e4a479659463ab9d3f6b4ca4dbd1",
231231
"assets/sample-projects/home-pages/assets/brand/bootstrap-logo-white.svg": "2e642df55357162ad28519305c8fd4fe",
232232
"assets/sample-projects/home-pages/assets/brand/bootstrap-logo.svg": "88eef7f3c2bcf988457a0e6d123c3f1d",
@@ -238,7 +238,7 @@
238238
"assets/sample-projects/home-pages/carousel/index.html": "fc5bf7b2d8640a2c393f465294210e7c",
239239
"assets/sample-projects/home-pages/cover/cover.css": "3738586a82dd90263617020e7f1db82e",
240240
"assets/sample-projects/home-pages/cover/index.html": "a0ae1a11224672532b3466df93ce0821",
241-
"assets/sample-projects/HTML5.zip": "459aaa945b714d74c01d1f8d5e8de299",
241+
"assets/sample-projects/HTML5.zip": "eee919921e4eb91e7727d576193b4f0b",
242242
"assets/sample-projects/HTML5/index.html": "ca318e370d63b3e083d3bd63052b8252",
243243
"assets/sample-projects/HTML5/script.js": "47de56d88cd6d866c4f77027128c0dd7",
244244
"assets/sample-projects/HTML5/styles.css": "8c798c8b3bba7e4d49dfe99b4deccd47",
@@ -248,13 +248,13 @@
248248
"brackets.config.dist.json": "067654f0936d60f59d5fa493c6b3ed1c",
249249
"brackets.config.staging.json": "53d44a23a939eaaaea05e072c8780584",
250250
"brackets.js": "474dfa12725ff8b674be85d5d64f8735",
251-
"cacheManifest.json": "938f52598cefb329413b2bdad765318b",
251+
"cacheManifest.json": "914cf2c10e4677d83f167e0f78f8375e",
252252
"command/CommandManager.js": "ebbc15626600575d2dfe2a97da2993a0",
253253
"command/Commands.js": "d1b78cbe3e6272c06e442d8c3441838c",
254254
"command/DefaultMenus.js": "082f4dc2fb1cfc6212195e651bd58d0e",
255255
"command/KeyBindingManager.js": "217d8614e1fb33918dbca0c452fa319a",
256256
"command/Menus.js": "7c0cfc8ef89ea0ea52317c57b155f6a9",
257-
"config.json": "b4cc21cff50920a3368e2a594a4c8a50",
257+
"config.json": "870feef967eee6c0f83d03e41901dd79",
258258
"devEnable.html": "afb2596268ea108f48121765e8244518",
259259
"document/ChangedDocumentTracker.js": "8763dbbd784b9e8a3614a8ee723d5273",
260260
"document/Document.js": "e54a90c638153d50fe7d23ffeeb0076c",
@@ -544,7 +544,7 @@
544544
"extensions/default/Phoenix/images/share-fill.svg": "6e05cae32cf606c11a7bdc5ce1d25c8d",
545545
"extensions/default/Phoenix/main.js": "7882fc31b9076dfbef6752d5d0360f33",
546546
"extensions/default/Phoenix/new-project.js": "5ba778ba22f80c11a4dab0ae33f7a394",
547-
"extensions/default/Phoenix/newly-added-features.js": "be5389190acbe6a0d57b44d200745d42",
547+
"extensions/default/Phoenix/newly-added-features.js": "1453e93c9c7f198f94b67ed66bd709f3",
548548
"extensions/default/Phoenix/package.json": "5f024da45db42092e3b5e919f1ca3e52",
549549
"extensions/default/Phoenix/requirejs-config.json": "d41d8cd98f00b204e9800998ecf8427e",
550550
"extensions/default/Phoenix/serverSync.js": "88f0a073987cfe4b46b0ec0021af2326",
@@ -919,7 +919,7 @@
919919
"phoenix/init_vfs.js": "179e233229f9ffc4cdf4d376a2210f40",
920920
"phoenix/shell.js": "98edc9dc5c01dc4ed317b243e716b9ba",
921921
"phoenix/tauriShell.js": "f937860b5e2dc46a4b5ed4f7ded2d36b",
922-
"phoenix/virtual-server-loader.js": "3e8a0a5edf58b45ed761dfcbb85aa21f",
922+
"phoenix/virtual-server-loader.js": "42e6ac2e05752addd3c3f72d0675a63a",
923923
"phoenix/virtualfs.js": "612dad83c82659da67ae0f2796f723ed",
924924
"phoenix/virtualServer/config.js": "d721dab94b79e730ee157f336e052b70",
925925
"phoenix/virtualServer/content-type.js": "23156f3d0e1be473d85d6492523c9d27",
@@ -1924,7 +1924,7 @@
19241924
"view/ViewCommandHandlers.js": "3b91d3fc69b987d3c921ddcc200c85c9",
19251925
"view/ViewStateManager.js": "695f3f492456e78e7ddf143e1c051b08",
19261926
"view/WorkspaceManager.js": "2f9dd80ee6a4528056a49903e009929f",
1927-
"virtual-server-main.js": "ce1f5232f0eecb13b653296ea1ee5fbb",
1927+
"virtual-server-main.js": "023cd991f4322d6137d1b0d5f6669988",
19281928
"widgets/bootstrap-alerts.js": "1a0048304bc7f9938b8235e8f5ce1ecb",
19291929
"widgets/bootstrap-button.js": "1441d0ebe0d5862ad9f0e05049548bdf",
19301930
"widgets/bootstrap-dropdown.js": "858806dca6c8f91e9d837c31a28e227f",

config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"extension_url": "https://s3.amazonaws.com/extend.brackets/{0}/{0}-{1}.zip",
2020
"extension_store_url": "https://store.core.ai/src/",
2121
"linting.enabled_by_default": true,
22-
"build_timestamp": "2023-01-02T16:01:51.452Z",
22+
"build_timestamp": "2023-01-03T06:14:37.480Z",
2323
"googleAnalyticsID": "G-P4HJFPDB76",
2424
"mixPanelID": "49c4d164b592be2350fc7af06a259bf3",
2525
"coreAnalyticsID": "phoenix",
@@ -28,7 +28,7 @@
2828
"buildtype": "dev"
2929
},
3030
"name": "Phoenix",
31-
"version": "3.0.5-19021",
31+
"version": "3.0.5-19023",
3232
"apiVersion": "3.0.5",
3333
"homepage": "https://core.ai",
3434
"issues": {

extensions/default/Phoenix/newly-added-features.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,25 @@ define(function (require, exports, module) {
5757
}, 3000);
5858
}
5959

60-
function _showReloadForUpdateDialog() {
60+
function _cacheUpdatedCB(err) {
61+
if(err) {
62+
Metrics.countEvent(Metrics.EVENT_TYPE.PLATFORM, "cache", "errorRefresh");
63+
return;
64+
}
6165
setTimeout(()=>{
62-
if(window.Phoenix.updatePendingReload){
66+
if(window.Phoenix.cache.showUpdateDialogue){
6367
Dialogs.showModalDialog(
6468
DefaultDialogs.DIALOG_ID_INFO,
6569
Strings.UPDATE_AVAILABLE_TITLE,
6670
Strings.UPDATE_RELOAD_APP
6771
);
68-
Metrics.countEvent(Metrics.EVENT_TYPE.PLATFORM, "updateDlg",
69-
window.Phoenix.updatePendingReloadReason || "shown");
72+
Metrics.countEvent(Metrics.EVENT_TYPE.PLATFORM, "updateDlg", "shown");
7073
}
7174
}, 5000);
75+
Metrics.countEvent(Metrics.EVENT_TYPE.PLATFORM, "cache",
76+
`${window.Phoenix.cache.updatePendingReloadReason}.done`);
77+
Metrics.countEvent(Metrics.EVENT_TYPE.PLATFORM, "cache", `updateCount`,
78+
window.Phoenix.cache.updatedFilesCount||0);
7279
}
7380

7481
async function _readMarkdownTextFile() {
@@ -93,12 +100,13 @@ define(function (require, exports, module) {
93100
console.error("Error while showing new feature markdown on update", e);
94101
});
95102
}
96-
_showReloadForUpdateDialog();
97103
}
98104

99105
exports.init = function () {
100106
if(!Phoenix.firstBoot && !window.testEnvironment){
101107
_showNewUpdatesIfPresent();
102108
}
109+
Metrics.countEvent(Metrics.EVENT_TYPE.PLATFORM, "cache", "doRefresh");
110+
window.refreshServiceWorkerCache(_cacheUpdatedCB);
103111
};
104112
});

phoenix/virtual-server-loader.js

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
* Based on https://github.com/humphd/nohost
2626
*
2727
* This module should be functionally as light weight as possible with minimal deps as it is a shell component.
28+
*
29+
* This file is always loaded fresh from network if available bypassing cache to help better resilience
30+
* against stale caches in service worker. So you can assume that this file will get loaded in its most recent
31+
* form despite the cache state in the browser.
2832
* **/
2933

3034

@@ -83,13 +87,17 @@ if (_isServiceWorkerLoaderPage() && 'serviceWorker' in navigator) {
8387
updateViaCache: 'none'
8488
});
8589

90+
let isServerReady = false;
91+
92+
window.Phoenix.cache = {};
93+
8694
/**
8795
* This will cause a full cache reset in the browser for the phoenix scripts.
8896
* This will help the user to load the latest version of phoenix on the next load.
8997
* @return {boolean}
9098
* @private
9199
*/
92-
function _forceClearCacheIfNeeded() {
100+
function _forceClearCacheIfNeeded(doneCB) {
93101
const cacheKey = "browserCacheVersionKey";
94102
const newCacheVersion = "V1"; // just increment this number to V2, v3 etc. to force clear the cached content.
95103
if(window.Phoenix.firstBoot){
@@ -99,34 +107,48 @@ if (_isServiceWorkerLoaderPage() && 'serviceWorker' in navigator) {
99107
const lastClearedVersion = window.localStorage.getItem(cacheKey);
100108
if(lastClearedVersion !== newCacheVersion) {
101109
console.log(`Service worker loader: triggering CLEAR_CACHE for live preview service worker upgrade`);
102-
window.Phoenix.updatePendingReload = true;
103-
window.Phoenix.updatePendingReloadReason = "clearCache";
104110
wb.messageSW({
105111
type: 'CLEAR_CACHE'
112+
}).then(({updatedFilesCount})=>{
113+
console.log(`Service worker loader: clear cache updatedFilesCount: `, updatedFilesCount);
114+
window.Phoenix.cache.updatePendingReloadReason = "clearCache";
115+
window.Phoenix.cache.showUpdateDialogue = true;
116+
window.Phoenix.cache.updatedFilesCount = updatedFilesCount || 0;
117+
localStorage.setItem(cacheKey, newCacheVersion);
118+
doneCB();
119+
}).catch(err=>{
120+
console.error("Service worker loader: Error while triggering clear cache", err);
121+
doneCB("CLEAR_CACHE Error");
106122
});
107-
localStorage.setItem(cacheKey, newCacheVersion);
108123
return true;
109124
}
110125
return false;
111126
}
112127

113-
function _refreshCache() {
114-
if(_forceClearCacheIfNeeded()){
128+
// refreshServiceWorkerCache should be done after app load to prevent mixed js script content load. Ie,
129+
// if we do the cache reset now, some scripts loaded may be from cache and some from the new version.
130+
window.refreshServiceWorkerCache = function (doneCB) {
131+
if(!isServerReady){
132+
setTimeout(()=>{
133+
window.refreshServiceWorkerCache(doneCB);
134+
}, 100);
135+
}
136+
if(_forceClearCacheIfNeeded(doneCB)){
115137
return;
116138
}
117139
console.log(`Service worker loader: triggering REFRESH_CACHE`);
118140
wb.messageSW({
119141
type: 'REFRESH_CACHE'
120142
}).then(({updatedFilesCount})=>{
121-
console.log(`Service worker loader: updatedFilesCount: `, updatedFilesCount);
122-
if(updatedFilesCount >0) {
123-
window.Phoenix.updatePendingReload = true;
124-
window.Phoenix.updatePendingReloadReason = "refreshCache";
125-
}
143+
console.log(`Service worker loader: refresh cache updatedFilesCount: `, updatedFilesCount);
144+
window.Phoenix.cache.updatePendingReloadReason = "refreshCache";
145+
window.Phoenix.cache.updatedFilesCount = updatedFilesCount || 0;
146+
doneCB();
126147
}).catch(err=>{
127-
console.error("Service worker loader: Error while triggering cache refresh", err);
148+
console.error("Service worker loader: Error while triggering refresh cache", err);
149+
doneCB("REFRESH_CACHE Error");
128150
});
129-
}
151+
};
130152

131153
// Hoist service worker comm to window for everyone be able to communicate with the sw.
132154
window.messageSW = function (params) {
@@ -135,6 +157,7 @@ if (_isServiceWorkerLoaderPage() && 'serviceWorker' in navigator) {
135157

136158
function serverReady() {
137159
console.log('Service worker loader: Server ready.');
160+
isServerReady = true;
138161
wb.messageSW({
139162
type: 'INIT_PHOENIX_CONFIG',
140163
debugMode: window.logToConsolePref === 'true',
@@ -144,7 +167,6 @@ if (_isServiceWorkerLoaderPage() && 'serviceWorker' in navigator) {
144167
}).catch(err=>{
145168
console.error("Service worker loader: Error while init of service worker", err);
146169
});
147-
_refreshCache();
148170
}
149171

150172
function serverInstall() {
@@ -176,7 +198,7 @@ if (_isServiceWorkerLoaderPage() && 'serviceWorker' in navigator) {
176198
// service worker has installed but is waiting to activate.
177199
wb.addEventListener('waiting', (event) => {
178200
console.log("Service worker loader: A new service worker is pending load. Trying to update the worker now.");
179-
// window.Phoenix.updatePendingReload = true; not set here to not show too many update dialogues.
201+
window.Phoenix.cache.updatePendingReloadReason = "skipWait";
180202
showSkipWaitingPrompt(event);
181203
});
182204

0 commit comments

Comments
 (0)