fix: workspace page blank — node.type not node.is_folder in flattenTree
The tree API returns {type: 'folder'|'page'} but flattenTree() was
accessing node.is_folder which is undefined for all items. All items
got is_folder: undefined → no children → but more critically, the
conditionals in the template also broke. Fixed to check node.type.
This commit is contained in:
@@ -176,9 +176,10 @@ function wsPage() {
|
|||||||
flattenTree(nodes, depth) {
|
flattenTree(nodes, depth) {
|
||||||
const result = [];
|
const result = [];
|
||||||
for (const node of nodes) {
|
for (const node of nodes) {
|
||||||
|
const isFolder = node.type === 'folder';
|
||||||
result.push({
|
result.push({
|
||||||
db_id: node.id, name: node.name, icon: node.is_folder ? '📁' : '📄',
|
db_id: node.id, name: node.name, icon: isFolder ? '📁' : '📄',
|
||||||
is_folder: node.is_folder, depth: depth,
|
is_folder: isFolder, depth: depth,
|
||||||
});
|
});
|
||||||
if (node.children) {
|
if (node.children) {
|
||||||
result.push(...this.flattenTree(node.children, depth + 1));
|
result.push(...this.flattenTree(node.children, depth + 1));
|
||||||
|
|||||||
Reference in New Issue
Block a user