feat(data)!: preload flag for AsyncDataService.createLazy - #171
Merged
Conversation
kunalkindra
force-pushed
the
kkindra/create-lazy-preload
branch
from
August 17, 2026 16:14
e306c4c to
f143312
Compare
krisnye
reviewed
Aug 17, 2026
kunalkindra
force-pushed
the
kkindra/create-lazy-preload
branch
from
August 17, 2026 17:39
f143312 to
53f32e2
Compare
BREAKING CHANGE: createLazy now takes a single object argument
{ load, properties, preload? } instead of positional (load, properties).
Adds an optional `preload` boolean (default false). When true, the service is
warmed at browser idle via requestIdleCallback instead of waiting for the first
property access, so the first real call never races a cold load. No-op where
requestIdleCallback is unavailable (SSR / Node / older browsers).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Documents contributing from a personal GitHub identity when a corporate/EMU account can't fork or push to the public repo, using ~/.ssh/config host aliases with IdentitiesOnly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Minor bump signaling the breaking createLazy signature change (positional → single object argument). Pre-1.0, so breaking lands as a minor version. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
kunalkindra
force-pushed
the
kkindra/create-lazy-preload
branch
from
August 17, 2026 19:35
c21c8f3 to
e04599b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
createLazynow takes a single object argument and gains an optionalpreloadflag:When
preload: true, the service is warmed at browser idle viarequestIdleCallbackinstead of waiting for the first property access — so the first realsend/ read / call never races a cold load. Defaults tofalse; it is a no-op whererequestIdleCallbackis unavailable (SSR / Node / older browsers), degrading to the existing lazy-on-first-touch behavior.Why
A lazy service loads only on first property access. That keeps heavy imports out of the initial bundle, but the first touch pays for the load — and if that touch happens right before the page tears down (e.g. an analytics event fired immediately before a navigation), the load can lose the race and the call is dropped.
preload: truecloses that window without giving up laziness.Breaking change
The signature changed from positional
createLazy(load, properties)to a single objectcreateLazy({ load, properties, preload? }). Every existing call site must migrate:Tests / docs
create-lazy.test.ts,example.ts); the@ts-expect-errortype-safety tests are preserved.preloadunset performs no eager load;preload: truewarms the service before any property touch and dedupes with the first real access.create-lazy.mdand theasync-data-serviceREADME to the object form.typecheck,lint, and the full data-package suite (2963 tests) pass.Also included
A
docs(data)commit adds a Corporate contributors section to the root README documenting how to contribute from a personal GitHub identity (SSH host aliases withIdentitiesOnly) when a corporate/EMU account can't fork or push — requested during review.