Skip to content

Introduce lazy API resource activation (lazyApiResource + LazyResource)#2201

Draft
myieye wants to merge 4 commits intodevelopfrom
codex/implement-lazy-loading-for-parts-of-speech
Draft

Introduce lazy API resource activation (lazyApiResource + LazyResource)#2201
myieye wants to merge 4 commits intodevelopfrom
codex/implement-lazy-loading-for-parts-of-speech

Conversation

@myieye
Copy link
Collaborator

@myieye myieye commented Mar 10, 2026

Motivation

  • Prevent automatic API calls before a resource is actually needed so throttling/cancellation or component teardown cannot swallow the initial fetch.
  • Allow registering project-scoped services (e.g. parts-of-speech) without forcing an immediate remote load.

Description

  • Added LazyResource class in project/lazy-resource.ts which wraps a runed ResourceReturn and only activates the underlying resource on first current read or refetch call.
  • Added lazyApiResource to ProjectContext in project/project-context.svelte.ts which composes a runed resource with an activation gate (LazyActivation) and returns a LazyResource that triggers the API factory on demand; apiResource now defaults to lazy when API is not yet available.
  • Reworked parts-of-speech.svelte.ts to use lazyApiResource so parts-of-speech are not fetched until needed.
  • Updated ShadcnProjectView.svelte to register the parts-of-speech service in project scope without forcing load.
  • Added a small LazyApiResourceHarness.svelte test helper used by tests.
  • Added unit/browser tests: lazy-resource.test.ts and lazy-api-resource.browser.test.ts that verify activation semantics and lazy fetch behavior.

Testing

  • Ran vitest unit tests including lazy-resource.test.ts, which passed.
  • Ran the browser-oriented test lazy-api-resource.browser.test.ts (via the test harness), which passed and confirmed the API factory is not called on initialization and that data is loaded after the first current read.

Codex Task

@coderabbitai
Copy link

coderabbitai bot commented Mar 10, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 32abb4ab-9d04-4b75-8600-28c7dd981f90

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/implement-lazy-loading-for-parts-of-speech
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the 💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related label Mar 10, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

UI unit Tests

  1 files  ± 0   57 suites  +3   28s ⏱️ +3s
148 tests + 8  148 ✅ + 8  0 💤 ±0  0 ❌ ±0 
218 runs  +11  218 ✅ +11  0 💤 ±0  0 ❌ ±0 

Results for commit 63034f3. ± Comparison against base commit 3f62d45.

♻️ This comment has been updated with latest results.

@argos-ci
Copy link

argos-ci bot commented Mar 10, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Mar 13, 2026, 11:29 AM

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

C# Unit Tests

165 tests  +3   165 ✅ +3   19s ⏱️ -1s
 23 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 63034f3. ± Comparison against base commit 3f62d45.

♻️ This comment has been updated with latest results.

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

Labels

codex 💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant