Skip to content

core: Added VirtualLazyFolder#36

Open
YentheFromGhent wants to merge 4 commits into
prozilla-os:mainfrom
YentheFromGhent:feat/lazy-folder-loading
Open

core: Added VirtualLazyFolder#36
YentheFromGhent wants to merge 4 commits into
prozilla-os:mainfrom
YentheFromGhent:feat/lazy-folder-loading

Conversation

@YentheFromGhent
Copy link
Copy Markdown

Added VirtualLazyFolder class with a onPopulate() function which the user can override.

@Prozilla
Copy link
Copy Markdown
Member

This wouldn't work because getFiles would return before the folder is populated. getFiles should await the promise, meaning the superclass needs to be adjusted to be async instead, and all call sites need to be adjusted also to await the promise getFiles, or any method that calls getFiles, returns.

@YentheFromGhent YentheFromGhent force-pushed the feat/lazy-folder-loading branch from 62b4e68 to 0c8b93f Compare May 20, 2026 08:03
@YentheFromGhent
Copy link
Copy Markdown
Author

Added loadContent() to VirtualFolder which does nothing, overridden in VirtualLazyFolder to await and cache the onPopulate() promise. getFilesAsync() and getSubFoldersAsync() now await loadContent() before returning, which allows callers that need guaranteed content to await them instead of relying on the update event.

@YentheFromGhent
Copy link
Copy Markdown
Author

Added Tests + small bugfix

@Prozilla
Copy link
Copy Markdown
Member

I think it would be cleaner to keep the VirtualFolder classs as is and to keep the lazy loading logic in the VirtualLazyFolder.

@YentheFromGhent
Copy link
Copy Markdown
Author

YentheFromGhent commented May 20, 2026

This would mean that you would have to type check the folder type every time you want to use asynchronous loading, which i think would be annoying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants