fix(files): look up tab from reactive array before setting content
This commit is contained in:
parent
ea44719685
commit
cfe3abcf00
1 changed files with 6 additions and 3 deletions
|
|
@ -111,12 +111,15 @@
|
|||
}
|
||||
activeTabPath = node.path;
|
||||
|
||||
// Load content
|
||||
// Load content — must look up from reactive array, not local reference
|
||||
fileLoading = true;
|
||||
try {
|
||||
tab.content = await readFileContent(node.path);
|
||||
const content = await readFileContent(node.path);
|
||||
const target = fileTabs.find(t => t.path === node.path);
|
||||
if (target) target.content = content;
|
||||
} catch (e) {
|
||||
tab.content = { type: 'Binary', message: `Error: ${e}` };
|
||||
const target = fileTabs.find(t => t.path === node.path);
|
||||
if (target) target.content = { type: 'Binary', message: `Error: ${e}` };
|
||||
} finally {
|
||||
fileLoading = false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue