Skip to content

EffectWeb 0.7.0

Choose a tag to compare

@DerpyCrabs DerpyCrabs released this 29 Sep 16:49
· 2 commits to main since this release

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/query and import query, queryGroup, infiniteQuery, infiniteResource, makeQueryCache, scopedQueryCache, observeQuery, and their types from it. available and resourceError remain in effectweb.
  • resourceComponent is removed. Define a query, whose identity is every argument, and read it in the view with observe(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, and UiPage are removed from effectweb/advanced. Paginate with infiniteQuery: views read it through querySource and load pages with fetchNextPage; controllers use infiniteResource.
  • scopedQueryCache moved from effectweb/advanced to @effectweb/query.
  • fromPromise is removed. Adapt Promise APIs at their boundary with Effect.tryPromise.
  • The effectweb/query-key lint (EW2002) checks query imported 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) and retryPage(...) load infinite-query pages from event handlers and commands.
  • lifetime() owns commands like modelOwner: run, cancel, isRunning, awaitIdle, and close.
  • programView accepts beforeDispose to capture DOM state before its child is disposed.
  • modelOwner.read() includes writes accepted while a command is starting.
  • protectSnapshot is available from effectweb/advanced for 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.