Skip to content

Conversation

@necolas
Copy link

@necolas necolas commented Jan 23, 2026

Introduce a lazy data loader (generateLazyDataLoader) as an alternative to the existing sync loader. The lazy loader computes tree nodes on-demand rather than upfront, which can improve initialization time for large file trees.

Changes:

  • Add generateLazyDataLoader in loader/lazy.ts with lazy node computation
  • Extract shared utilities into createLoaderUtils factory (flattenHelpers.ts)
  • Add sortChildren.ts with semantic sorting (folders first, dot-prefixed, alphabetical)
  • Add FLATTENED_PREFIX constant for the f:: marker used by flattened nodes
  • Create shared test infrastructure (loader.shared.ts) to run identical test
    cases against both loaders

The lazy loader defers computation of node properties (name, children, etc.) until they are first accessed, making it suitable for trees where only a subset of nodes are typically expanded.

Before After
image image
  • Bug fix (non-breaking change which fixes an issue)
  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality). You must have
    first discussed with the dev team and they should be aware that this PR is
    being opened
  • Breaking change (fix or feature that would change existing functionality).
    You must have first discussed with the dev team and they should be aware
    that this PR is being opened
  • Documentation update

Checklist

  • I have read the
    contributing guidelines
  • My code follows the code style of the project (bun run lint)
  • My code is formatted properly (bun run format)
  • I have updated the documentation accordingly (if applicable)
  • I have added tests to cover my changes (if applicable)
  • All new and existing tests pass (bun run diffs:test)

How was AI used in generating this PR

  • Creating tests
  • Fixing bugs

@vercel
Copy link

vercel bot commented Jan 23, 2026

@necolas is attempting to deploy a commit to the Pierre Computer Company Team on Vercel.

A member of the Team first needs to authorize it.

Use unsorted input data to test library's ability to provide consistent
rendering results.
Introduce a lazy data loader (`generateLazyDataLoader`) as an alternative to
the existing sync loader. The lazy loader computes tree nodes on-demand rather
than upfront, which improves initialization time for large file trees.

Changes:
- Add `generateLazyDataLoader` in `loader/lazy.ts` with lazy node computation
- Extract shared utilities into `createLoaderUtils` factory (`flattenHelpers.ts`)
- Add `sortChildren.ts` with semantic sorting (folders first, dot-prefixed, alphabetical)
- Add `FLATTENED_PREFIX` constant for the `f::` marker used by flattened nodes
- Create shared test infrastructure (`loader.shared.ts`) to run identical test
  cases against both loaders

The lazy loader defers computation of node properties (name, children, etc.)
until they are first accessed, making it suitable for trees where only a
subset of nodes are typically expanded.
@necolas necolas force-pushed the file-tree/lazy-data-loader branch from a46d661 to 3b7cbed Compare January 23, 2026 22:18
@necolas
Copy link
Author

necolas commented Jan 23, 2026

Just putting this up to share. Not sure what your plan was for ordering files properly and non-sync data loaders. Something like this is what I used elsewhere to order files a la VSCode

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.

1 participant