npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bgub/fig-convex

v0.1.0

Published

Native Fig queries and Suspense over Convex clients

Readme

@bgub/fig-convex

Experimental native Fig queries over Convex's framework-independent clients. Fig owns cached values and Suspense; mounted readers own shared live subscriptions. There is no React runtime or second query cache.

Create createConvexBrowserQueries({ data, client, scope }) from /client, or createConvexServerQueries({ data, client, scope }) from /server. The server factory uses the HTTP client's consistent queries. Create a fresh authenticated HTTP client and Fig store for each request. The caller owns authentication and closing the browser client. scope must be the same non-secret session identity on server and browser, or a fixed public scope for anonymous data.

Call queries.query(api.episodes.get, { id }) to obtain a typed, shared handle. In the loader, await handle.prefetchQuery() for critical data; start secondary prefetches without returning their promises. In the component, call useSuspenseQuery(handle) from /query inside a nearby Suspense/error boundary. The returned { data } retains the generated Convex function's return type.

handle.retry() invalidates the stored error/value before remounting an error boundary. queries.dispose() retires subscriptions and pending initial reads. It does not purge fulfilled Fig data. For TinyLingo, preserve the existing full-document reload after sign-out; retire queries before changing identity. Do not reuse a disposed session's registry or Fig store for a different user.

The public factories accept existing Convex clients. Call their native mutation and action methods with Fig action state; actions are not cached queries.

Build with pnpm --filter @bgub/fig-convex build. Package exports contain compiled ESM and declaration files. Tests cover hydration, committed-reader ownership, shared descriptors, errors/retry, request identity, and late callback retirement. TinyLingo uses these adapters across its migrated web routes. App-level tests cover hydration, auth transitions and mutation invalidation with controlled transports. Real signed-in deployment and reconnect checks remain release gates.

The app runtime's queryClient.invalidate(query?) accepts a typed Convex query reference. It refreshes all cached argument variants of that query; omit the reference to refresh all registered queries. convexQuery(query, args) describes a resource for fetching and prefetching and does not expose compatibility keys.

queryClient.setQueryData(convexQuery(query, args), value) seeds an authenticated resource from a mutation's authoritative response. Readers can render immediately without another initial query; mounted readers still subscribe to live updates. The seed belongs to the current registry's session scope and cannot be written after disposal.

appData.fetchAccessToken(forceRefresh?) shares the browser client's token cache with authenticated media requests. It deduplicates renewal, refreshes JWTs near expiration, and returns null after session retirement. Keep media caches scoped to that app and clear them when identity changes; tokens are never cache keys.

useConvexMutation(reference, { optimisticUpdate }) accepts a typed Convex optimistic update. Change immutable query snapshots in its local store; Convex replays pending updates over fresh server data and removes them on success or failure. Live Fig readers receive these changes through the existing subscription. The HTTP/SSR client ignores the optimistic option. Keep permission changes server-authoritative; an optimistic result is never an access grant.

The returned runner also accepts per-call options: mutate(args, { optimisticUpdate }). Use these to capture a temporary creation ID once per submission, before Convex replays the update. Per-call options override the hook's defaults for that call.