feat(core): incrementally load items
This commit is contained in:
@@ -18,7 +18,9 @@ fn loadChildren(container: *Container) void {
|
||||
while (it.next() catch return) |entry| {
|
||||
const child = container.item.fullName.getChild(entry.name, container.item.allocator) catch return;
|
||||
|
||||
container.children.append(child) catch return;
|
||||
container.children.mutex.lock();
|
||||
defer container.children.mutex.unlock();
|
||||
container.children.data.append(child) catch return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +110,9 @@ pub const LocalContentProvider = struct {
|
||||
.directory => blk: {
|
||||
const container = try allocator.create(Container);
|
||||
container.* = Container{
|
||||
.children = std.ArrayList(FullName).init(allocator),
|
||||
.children = locked(std.ArrayList(FullName)){
|
||||
.data = std.ArrayList(FullName).init(allocator),
|
||||
},
|
||||
.childrenLoading = true,
|
||||
.item = undefined,
|
||||
};
|
||||
@@ -214,3 +218,4 @@ const ItemEnum = models.ItemEnum;
|
||||
const Element = models.Element;
|
||||
const Container = models.Container;
|
||||
const native_os = @import("builtin").os.tag;
|
||||
const locked = @import("../sync.zig").locked;
|
||||
|
||||
Reference in New Issue
Block a user