EffectWeb 0.7.0
EffectWeb 0.7.0 moves server data into a separate @effectweb/query package built around one kind of cached query, and adds owned commands to lifetime().
Breaking changes and migration
- Install
@effectweb/queryand importquery,queryGroup,infiniteQuery,infiniteResource,makeQueryCache,scopedQueryCache,observeQuery, and their types from it.availableandresourceErrorremain ineffectweb. resourceComponentis removed. Define aquery, whose identity is every argument, and read it in the view withobserve(querySource(cache, query, args), render). Loaders take services from the cache runtime,makeQueryCache(uiRuntime(context)), not from props or closures.pages, its model and message types, andUiPageare removed fromeffectweb/advanced. Paginate withinfiniteQuery: views read it throughquerySourceand load pages withfetchNextPage; controllers useinfiniteResource.scopedQueryCachemoved fromeffectweb/advancedto@effectweb/query.fromPromiseis removed. Adapt Promise APIs at their boundary withEffect.tryPromise.- The
effectweb/query-keylint (EW2002) checksqueryimported from@effectweb/query.
Additions and fixes
querySource(cache, query, args)returns a live, cached source for views. Equal arguments share one source, which loads while observed and is released when the last observer leaves. It also accepts infinite queries.fetchNextPage(cache, query, args)andretryPage(...)load infinite-query pages from event handlers and commands.lifetime()owns commands likemodelOwner:run,cancel,isRunning,awaitIdle, andclose.programViewacceptsbeforeDisposeto capture DOM state before its child is disposed.modelOwner.read()includes writes accepted while a command is starting.protectSnapshotis available fromeffectweb/advancedfor adapter authors.- Render-safety lint checks callback props passed to components, and accepts functions supplied through the view's model, whose closures are checked where they are created.
- Identity lint (EW3001) treats literal tuples and records, such as
[['id', 'Label']].map(...), as fixed rows.
All 15 npm packages share version 0.7.0; @effectweb/query is new. The Effect peer remains effect@4.0.0-rc.112. Native compiler packages support glibc Linux x64/arm64, macOS x64/arm64, and Windows x64.
Packaging
The release workflow verified all platforms and published 14 packages with npm provenance. @effectweb/query was published once from the maintainer's machine, because npm trusted publishing requires an existing package.