Compare commits
43 Commits
customized
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
52c55b5988 | 1 month ago |
|
|
bc02892413 | 1 month ago |
|
|
f23d0774f8 | 1 month ago |
|
|
bea38a7e36 | 1 month ago |
|
|
294894ea56 | 1 month ago |
|
|
406b88e0cf | 1 month ago |
|
|
43fddf44b8 | 1 month ago |
|
|
40bc22f6e8 | 1 month ago |
|
|
faaaf2d5bb | 1 month ago |
|
|
6543571b96 | 1 month ago |
|
|
2a21018544 | 1 month ago |
|
|
923df3cc56 | 1 month ago |
|
|
d31d00c0e7 | 1 month ago |
|
|
4599b3d39b | 3 months ago |
|
|
8273b7eebb | 3 months ago |
|
|
ded88c7721 | 3 months ago |
|
|
fd610e2bd8 | 3 months ago |
|
|
abe0fc554a | 3 months ago |
|
|
f1fe33942e | 3 months ago |
|
|
755afe1483 | 3 months ago |
|
|
84835607d3 | 3 months ago |
|
|
2abcd07184 | 3 months ago |
|
|
ab4a0e99cc | 3 months ago |
|
|
3bb7164b4f | 3 months ago |
|
|
4a320f62f2 | 3 months ago |
|
|
9037901d03 | 3 months ago |
|
|
8fcf17568b | 3 months ago |
|
|
84736d074e | 3 months ago |
|
|
c6937367c4 | 3 months ago |
|
|
861b829bc5 | 3 months ago |
|
|
107ca923fa | 3 months ago |
|
|
9f974861e5 | 3 months ago |
|
|
347becdec0 | 3 months ago |
|
|
8bc11c0de1 | 3 months ago |
|
|
6dad941b96 | 3 months ago |
|
|
697f13d6c3 | 3 months ago |
|
|
2657452977 | 3 months ago |
|
|
e410fabf20 | 3 months ago |
|
|
8e70ea94ef | 3 months ago |
|
|
020b9235a8 | 3 months ago |
|
|
e9f19eb810 | 3 months ago |
|
|
38b59621e3 | 3 months ago |
|
|
a664e6bd90 | 3 months ago |
Binary file not shown.
|
Before Width: | Height: | Size: 988 B After Width: | Height: | Size: 9.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 988 B |
@ -0,0 +1,48 @@
|
||||
function hasObjectValues(value) {
|
||||
return Boolean(value && typeof value === 'object' && Object.keys(value).length > 0);
|
||||
}
|
||||
|
||||
function hasInitialCanvasData(initialData, useDefault) {
|
||||
if (!initialData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Array.isArray(initialData)) {
|
||||
return initialData.length > 0;
|
||||
}
|
||||
|
||||
if (useDefault) {
|
||||
return hasObjectValues(initialData?.main?.components) || hasObjectValues(initialData?.components);
|
||||
}
|
||||
|
||||
return hasObjectValues(initialData);
|
||||
}
|
||||
|
||||
function hasCanvasContent(canvas) {
|
||||
return Boolean(
|
||||
canvas &&
|
||||
((Array.isArray(canvas.nodes) && canvas.nodes.length > 0) ||
|
||||
(Array.isArray(canvas.edges) && canvas.edges.length > 0))
|
||||
);
|
||||
}
|
||||
|
||||
function shouldUseCachedCanvas({ cachedCanvas, initialData, useDefault }) {
|
||||
if (!cachedCanvas) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hasCanvasContent(cachedCanvas)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !hasInitialCanvasData(initialData, useDefault);
|
||||
}
|
||||
|
||||
function shouldPersistCanvas({ nodes, edges }) {
|
||||
return hasCanvasContent({ nodes, edges });
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
shouldUseCachedCanvas,
|
||||
shouldPersistCanvas,
|
||||
};
|
||||
@ -0,0 +1,28 @@
|
||||
function isScheduledRunning(app) {
|
||||
return app && (app.scheduled === 1 || app.scheduled === '1' || app.scheduled === true);
|
||||
}
|
||||
|
||||
function buildRuntimeReconnectRequest({ app, socketId, lastReconnectKey }) {
|
||||
const instanceId = app && app.instanceId ? String(app.instanceId) : '';
|
||||
const newSocketId = socketId ? String(socketId) : '';
|
||||
const appKey = app && (app.id || app.key) ? String(app.id || app.key) : '';
|
||||
|
||||
if (!isScheduledRunning(app) || !instanceId || !newSocketId || !appKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const reconnectKey = `${appKey}:${instanceId}:${newSocketId}`;
|
||||
if (reconnectKey === lastReconnectKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
instanceId,
|
||||
newSocketId,
|
||||
reconnectKey,
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
buildRuntimeReconnectRequest,
|
||||
};
|
||||
Loading…
Reference in New Issue