forked from wrenn/wrenn
v0.1.6 (#45)
## What's New? Performance updates for large capsules, admin panel enhancement and bug fixes ### Envd - Fixed bug with sandbox metrics calculation - Page cache drop and balloon inflation to reduce memfile snapshot - Updated rpc timeout logic for better control - Added tests ### Admin Panel - Add/Remove platform admin - Updated template deletion logic for fine grained permission ### Others - Minor frontend visual improvement - Minor bugfixes - Version bump Co-authored-by: Tasnim Kabir Sadik <tksadik92@gmail.com> Reviewed-on: wrenn/wrenn#45 Co-authored-by: pptx704 <rafeed@omukk.dev> Co-committed-by: pptx704 <rafeed@omukk.dev>
This commit is contained in:
@ -120,6 +120,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
function mergeCapsuleData(incoming: Capsule[]) {
|
||||
const existingMap = new Map(capsules.map((c) => [c.id, c]));
|
||||
const merged: Capsule[] = [];
|
||||
for (const fresh of incoming) {
|
||||
const existing = existingMap.get(fresh.id);
|
||||
if (existing) {
|
||||
for (const key of Object.keys(fresh) as (keyof Capsule)[]) {
|
||||
if (existing[key] !== fresh[key]) {
|
||||
(existing as any)[key] = fresh[key];
|
||||
}
|
||||
}
|
||||
merged.push(existing);
|
||||
} else {
|
||||
merged.push(fresh);
|
||||
}
|
||||
}
|
||||
capsules = merged;
|
||||
}
|
||||
|
||||
async function fetchCapsules(manual = false) {
|
||||
const wasEmpty = capsules.length === 0;
|
||||
if (wasEmpty) loading = true;
|
||||
@ -131,7 +150,11 @@
|
||||
|
||||
const result = await listCapsules();
|
||||
if (result.ok) {
|
||||
capsules = result.data;
|
||||
if (wasEmpty) {
|
||||
capsules = result.data;
|
||||
} else {
|
||||
mergeCapsuleData(result.data);
|
||||
}
|
||||
error = null;
|
||||
} else {
|
||||
error = result.error;
|
||||
|
||||
Reference in New Issue
Block a user