ui: hide, don't clear, children of non-selectable DFs

- pysimFsLoadChildren failure now only marks exists=false and re-renders;
  loaded children stay in the node and are hidden by the renderer (red
  cross, no toggle, no (empty)), so a failed DF is re-attempted on the
  next probe/refresh instead of being short-circuited
- dropped the parent_sel-less /api/tree retry: error payloads now carry
  exists:false, so it doubled requests for every absent DF and re-selected
  the same FID without its parent (pySim probe_file fallback)
- probe walks strictly on exists===true and never collects files under a
  non-existing DF; no longer clears children on a failed EF select
- tests updated: single request per failed load, children untouched,
  200 exists:false marks absent without retry, render hides stale
  children, probe never fetches/selects them; SW cache v116 -> v117.
This commit is contained in:
2026-09-12 21:23:31 +03:00
parent 92271d6726
commit 85a66af7a5
5 changed files with 50 additions and 23 deletions
+16 -11
View File
@@ -54,9 +54,9 @@ test('tree error payload marks the directory as absent', async () => {
];
await pysimFsLoadChildren(node);
assert.strictEqual(node.exists, false);
assert.deepStrictEqual(node.children, []);
assert.strictEqual(node.children, null);
assert.strictEqual(renders, 1);
assert.strictEqual(calls.length, 2);
assert.strictEqual(calls.length, 1);
assert.strictEqual(calls[0].body.parent_sel, 'MF');
});
@@ -68,23 +68,28 @@ test('error payload without exists is not treated as an empty listing', async ()
];
await pysimFsLoadChildren(node);
assert.strictEqual(node.exists, false);
assert.deepStrictEqual(node.children, []);
assert.strictEqual(node.children, null);
assert.strictEqual(renders, 1);
assert.strictEqual(calls.length, 1);
});
test('retry without parent_sel succeeds and maps children', async () => {
test('a 200 exists:false response marks the directory absent without retrying', async () => {
const node = setup();
responses = [
{ exists: false },
{ exists: true, children: [{ name: 'EF.IMSI', fid: '6f07', isDir: false }] },
];
responses = [{ exists: false }];
await pysimFsLoadChildren(node);
assert.strictEqual(node.exists, false);
assert.strictEqual(node.children, null);
assert.strictEqual(calls.length, 1);
});
test('a node with loaded children is not fetched again', async () => {
const node = setup();
node.exists = true;
node.children = [{ name: 'EF.UPLMNWLAN', fid: '4f42', isDir: false, exists: true }];
await pysimFsLoadChildren(node);
assert.strictEqual(node.exists, true);
assert.strictEqual(node.children.length, 1);
assert.strictEqual(node.children[0].parent, node);
assert.strictEqual(node.children[0].exists, true);
assert.strictEqual(calls[1].body.parent_sel, undefined);
assert.strictEqual(calls.length, 0);
});
test('empty successful listing keeps the directory present', async () => {