WildflowerJS Reactive JS, No BS*

A no-build reactive JavaScript framework, rooted in the web platform.
No build step. No dependencies. No compromises.

Latest release: v1.5.0 · see what's new
<script src="wildflower.min.js"></script> ...and start building.

Back to Basics

With WildflowerJS, you write 100% standard code. HTML stays HTML. JavaScript stays JavaScript. CSS stays CSS. There's no JSX, templating language, or custom syntax to learn. If you know the standards, you already know how to use WildflowerJS.

WildflowerJS extends the web platform. It doesn't replace it.

Your Development Simplified

Because you develop with 100% web standards, every tool in your existing chain already understands the code: IDE, browser DevTools, linter, formatter, screen reader, SEO crawler. There's nothing to install, and no custom file types or sourcemaps. Save the file, refresh, and your change is live.

Just be a web developer.

Batteries Included: One Mental Model

Router, SSR, queries, stores, computed properties, two-way binding, event modifiers, data pools, and TypeScript types, all built in, all using the same API. Learn data-bind once and you know binding everywhere: in lists, pools, stores, plugins. There's no five-library stack to keep in sync.

One script tag. Everything you need.

<div data-component="counter">
  <span data-bind="count"></span>
  <button data-action="increment">
    +1
  </button>
</div>

<script>
wildflower.component('counter', {
  state: { count: 0 },
  increment() { this.count++ }
})
</script>

How It Works

data-bind connects state to the DOM.

data-action connects events to methods.

this.count++ triggers a precise DOM update.

Mutate state. The DOM updates.

Two Reactivity Modes

data-list is for automatic reactivity: mutate state, the DOM updates. data-pool is for explicit control: plain objects, zero proxy overhead, you say what changed.

Both use the same template syntax and differ in performance profile, from interactive forms to per-frame particle systems. You choose the tradeoff that fits the job.

Try it. Right-click, inspect this demo. Every dot is a real DOM element.

See full demo →

* Build Step

No Toolchain

Modern frameworks ask you to install a compiler, a bundler, a package manager, hundreds of fragile transitive dependencies, and a framework-specific file format, before you write a single line of your application.

WildflowerJS was built starting from a single principle: no build step, no tooling. Ever.

WildflowerJS asks you to add a script tag.

There's no CLI scaffolding step, config file, or .vue/.jsx/.svelte source format. You don't debug through sourcemaps or wait on a build pipeline. Your project has zero dependencies.

Performance isn't a tradeoff. Build steps optimize bundle delivery, not the runtime work that follows it. WildflowerJS writes directly to the DOM, with no virtual DOM or reconciliation pass between state change and update, so it doesn't need a build step to be fast.

The framework is full-featured without the toolchain, including router, SSR, stores, computed properties, transitions, and pools.

my-app/
  index.html
  app.js
  style.css
  wildflower.min.js

That's the entire project. No package.json, no node_modules, no config files. NONE of that.

No Install. No Attack Surface.

Every dependency you install lets a maintainer you have never met run scripts on your dev machine and in your CI. A typical React + Vite + UI‑lib setup pulls in 300+ transitive packages before you write a feature.

Each one is a potential intrusion vector. NPM worms, OAuth chains compromising deploy platforms, postinstall hijacking: the supply chain is now where production code gets compromised, not the deploy. And signing isn't a backstop: Mini Shai‑Hulud (May 2026) compromised 170+ packages whose malicious versions carried valid SLSA Build Level 3 provenance, because the attestation came from build infrastructure the worm had already taken over.

A WildflowerJS project has none of that surface. There is no npm install, postinstall script, or transitive package graph. The framework is one file you copy or pin by hash.

As of v1.1, the same holds for building the framework itself. WildflowerJS bundles with a vendored rollup and terser pipeline pulled as three SHA‑512‑pinned tarballs, with no npm install and no transitive packages in the build path. The entire toolchain is three files verified by hash.

A typical React/Vue project:

  npm install
  ├── hundreds of packages
  ├── from hundreds of maintainers
  ├── postinstall scripts run on install
  └── tens to hundreds of MB of transitive code

WildflowerJS:

  <script src="wildflower.min.js"></script>
  └── 1 file.
      No transitive dependencies.

No Compromise

WildflowerJS doesn't compromise performance for ease-of-use. Even with no build step, WildflowerJS performs at the level of frontier frameworks on the official js-framework-benchmark board, where its data-pool entry outpaces every major framework and its standard entry sits with the fastest signal-based compilers. And for per-frame workloads, data pools lead every framework we tested in our Lorenz attractor simulation demo.

The charts here are the overall geomean standings and the operation breakdown from the official September 2026 run, plus the sustained frame rate from our per-frame animation sweep. Click any chart to see it full size.

Delivery is fast too, because there's less to deliver. It ships as one file, with no runtime split across chunks and no hydration pass. Lighthouse scores hold their own against compiled frameworks without a single build artifact.

WildflowerJS doesn't trade simplicity of interface for performance of implementation.

Benchmark setup: the two js-framework-benchmark charts show the official September 2026 run (Chrome 152; MacBook Pro 14, M4 14/20 cores, 48 GB RAM, macOS 26.6.2; puppeteer driver), operations 1 through 9, total-duration medians, lower is better. The frame-rate chart is our own sweep: each framework's fastest variant on the Lorenz attractor for 8 seconds per particle count, fullscreen on a 120 Hz panel, higher is better; Apple M5 Pro, 24 GB RAM, macOS 26.5.2, Google Chrome 150 (stable, headed).

Bar chart of the official weighted geometric mean slowdown versus the fastest implementation per operation, Chrome 152: WF-pool 1.09, Vue Vapor 1.12, Solid 1.13, WF 1.16, Svelte 1.17, Vue 1.31; vanilla 1.04 and React 1.58 not shown. Lower is better.
Geomean slowdown vs fastest per operation. Lower is better.
Grouped bar chart of all nine js-framework-benchmark operations for Solid, Svelte, Vue, Vue Vapor, WF, and WF-pool from the official Chrome 152 run, with per-operation rankings. WF-pool is fastest on most operations.
All nine operations, side by side. Stars mark the fastest.
Line chart of sustained FPS versus particle count on the Lorenz attractor for Solid, Svelte, Vue, Vue Vapor, WF, and WF-pool. WF-pool holds the highest frame rate at every count, staying above 60 FPS past 4500 particles.
Per-frame animation. Sustained FPS as particle count grows; higher is better.

No Lock-in

WildflowerJS works with the DOM, not instead of it. There's no virtual DOM intercepting your code and no compiler rewriting your markup. The render cycle is yours alone.

That means Leaflet, DataTables, Chart.js, D3, Three.js, any library that touches the DOM, just works. There are no wrapper packages or framework-specific escape hatches required. Drop in a script tag, it's ready to go.

Because your code is standard HTML and JavaScript, you're never locked in. Your skills transfer and your code is more portable. If you outgrow the framework, your knowledge doesn't expire.

This also means your "ecosystem" is the whole of vanilla JS, with no compromises or hacks.

<!-- Use any library directly -->
<div data-component="map-view">
  <div id="map" style="height: 400px"></div>
</div>
wildflower.component('map-view', {
  state: { lat: 51.505, lng: -0.09 },
  init() {
    // Leaflet works as-is. No wrappers.
    this._map = L.map('map')
      .setView([this.lat, this.lng], 13);
    L.tileLayer('https://{s}.tile.osm.org'
      + '/{z}/{x}/{y}.png').addTo(this._map);
  }
})

Precise Reactivity

When you write this.count++, WildflowerJS updates the single DOM node bound to count. Nothing else is touched. There's no tree diffing or reconciliation pass to figure that out.

You get fine-grained updates and a simple mental model. Change a property, the bound element updates. That's the entire reactivity model.

Other frameworks ask you to learn signals, accessors, memos, effects, and subscription lifecycles to achieve what WildflowerJS does with a standard JS property assignment.

wildflower.component('dashboard', {
  state: {
    users: 1420,
    status: 'healthy'
  },
  computed: {
    summary() {
      return this.users + ' users, ' + this.status;
    }
  },
  refresh() {
    this.users = 1421;
    // Only the elements bound to 'users'
    // and 'summary' update. Everything
    // else on the page is untouched.
  }
})

One Reactivity Model. Everywhere.

Components, Stores, and Plugins, Pools, and now Data Queries all share the same reactive foundation. State, computed properties, and methods work identically no matter where they live. Learn it once, it works the same way across all of those entities.

Other frameworks make you learn a different system for each layer. React components use hooks, but stores need Redux or Zustand, which are completely different APIs. Vue components use reactive data, but Pinia stores have their own patterns. Every layer is a new mental model.

In WildflowerJS, there's one model. A store is a component without a template. A plugin is an entity that extends the framework itself, adding directives, lifecycle hooks, and services. The same this.count++ triggers the same reactivity everywhere.

This makes patterns possible that other frameworks cannot express. A store can run headless physics simulations with tick(), feeding data into a component that renders it through a pool, all using the same reactive primitives, no glue code required.

// Component: reactive UI
wildflower.component('cart', {
  state: { items: [] },
  computed: {
    total() { return this.items.length; }
  }
})

// Store: global shared state
wildflower.store('user', {
  state: { name: '', role: 'guest' },
  computed: {
    isAdmin() { return this.role === 'admin'; }
  }
})

// Plugin: extends the framework
wildflower.plugin({
  name: 'notifications',
  state: { items: [], unreadCount: 0 },
  computed: {
    hasUnread() { return this.unreadCount > 0; }
  },
  add(msg) { this.items.push(msg); this.unreadCount++; }
})
// Access globally: wildflower.$notifications.add(...)

// Same state. Same computed. Same methods.

Live Server Data: Built In, Stays True

With WildflowerJS SSR, the page arrives with its data already in the HTML. The server (your server, whatever back-end you prefer) renders your data into real HTML, so the first paint is real content, indexable and readable before a line of JavaScript runs. And because the markup is genuine HTML, hydration reads the page's state straight back out of the document. Server-rendered components end up exactly equivalent to client-rendered ones.

v1.3 brings data-query, which does for the rest of the page's life what SSR does for first load. Most frameworks hand you fetch() and leave the rest to you. There's an entire ecosystem of client data libraries that exists to fill that gap. WildflowerJS makes it a declaration instead. Name a source, point an element at it, say how fresh it should stay. Loading and error states, refresh on demand, request racing, and the whole refresh ladder (poll, conditional GET, focus, reconnect, server push) come with it. There is also no query language. Refinement is an ordinary computed property, and filtering happens client-side without a network round trip.

v1.5 completes the shape with writes. A query that declares where its rows come from can declare where changes go: to: is the transport, write() applies the change on screen immediately, and confirmation: decides what the server's answer means. If the server refuses, only the fields that write still owns revert, so two writes to the same row never clobber each other and you write no cancellation logic to get it. Computed properties may also return a promise now, holding the last settled value while the next one resolves.

Together, Wildflower's SSR and data-query cover one job at two different times. The server renders the page with real data. Because hydration reads the page itself, there's no flash of empty content, no loading spinner over data the user can already see, and no hydration scripts locking up the main thread. The server's render is the actual UI. When paired with data-query, your SSR becomes the first result of a standing query. The query adopts that markup and keeps it updated from there.

In the example above, the markup is 100% HTML.

<div data-component="product-board">
  <p data-show="$products.isLoading">
    Loading…
  </p>
  <p data-show="$products.error">
    Failed.
    <button data-action="retry">Retry</button>
  </p>

  <span data-bind="$products.count"></span>
  products

  <tbody data-query="products">
    <template>
      <tr>
        <td data-bind="name"></td>
        <td data-bind="stock"></td>
      </tr>
    </template>
  </tbody>
</div>
// The entire data layer:
wildflower.query('products', {
  from: '/api/products',
  key: 'id',
  refresh: ['focus', 'etag:60'],

  // v1.5: where changes go
  to: '/api/products/:id',
  body: (item) => item,
  confirmation: (d) => d.product
});

// The key plus only what changed. On screen
// at once; if the server refuses, only those
// fields revert.
getQuery('products')
  .write({ id: 42, stock: 40 });

// Server-rendered page? Add data-ssr="true"
// and the markup the server sent becomes the
// query's first result. Live from there.

Data Pools

Every framework wraps collection items in reactive proxies, whether the item needs it or not. WildflowerJS gives you a choice: data-list for push reactivity (automatic), data-pool for pull reactivity (explicit control, zero proxy overhead).

Pools render plain objects with the same template syntax as lists. Mutate the object, call markDirty(), and only that item updates. Full CRUD, selection, bulk operations, all faster than the push-reactive path.

And because pools use pull-based rendering, they scale to simulations, games, particle systems, and data visualizations at native frame rate, which a virtual DOM cannot sustain. No other framework offers this choice.

<div data-component="user-table">
  <tbody data-pool="users" data-key="id">
    <template>
      <tr>
        <td data-bind="name"></td>
        <td data-bind="status"
            data-bind-class="status === 'active'
              ? 'badge success'
              : 'badge inactive'"></td>
      </tr>
    </template>
  </tbody>
</div>
wildflower.component('user-table', {
  pools: { users: {} },

  init() {
    // Populate: plain objects, no proxies
    data.forEach(u => this.pools.users.add(u));
  },

  // Optional: add tick() and the same pool
  // renders every frame. Same template, same
  // data, different rendering frequency.
  // That's the only difference between a
  // display table and a particle system.
})

Built for AI-Assisted Development

Because WildflowerJS is standard HTML and JavaScript, AI code assistants already know how to write it. There's no custom syntax to hallucinate or compiler quirks to work around. The code an AI generates runs exactly as written, with no build step between generation and execution.

WildflowerJS ships an AI-optimized reference page with patterns, anti-patterns, and examples designed for code generation context windows. Our llms.txt file follows the llms.txt convention for machine-readable documentation.

You: "Build me a todo app with
WildflowerJS"

AI reads llms.txt or ai-assistant.html
     ↓
Generates standard HTML + JS
     ↓
<div data-component="todo-app">
  <input data-model="newItem">
  <button data-action="addItem">
    Add
  </button>
  <ul data-list="items">
    <template>
      <li data-bind="text"></li>
    </template>
  </ul>
</div>
     ↓
Open in your browser. It works, and you can read and understand the code.

Writes FULL v1.5+

A query declares where its data comes from with from, and where changes go with to. This page covers declaring that destination and calling write() and create(), including how the query reads the server's answer. Optimistic Updates and Rollback covers what appears on screen while the request is still out.

Declaring the Destination v1.5+

The shortest way to declare a write side is a URL. to is the row's address, and the query derives the two operations every row has:

wildflower.query('items', {
    from: '/api/items',
    key: 'id',
    deleted: 'removed',

    to:   '/api/items/:id',   // update at PATCH, delete at DELETE
    body: item => item        // what to send
});

wildflower.getQuery('items').write({ id: 42, done: true });     // PATCH /api/items/42
wildflower.getQuery('items').write({ id: 42, removed: true });  // DELETE /api/items/42

The URL is used exactly as written. Nothing is invented from it, and only the verb differs between the two. The verb is PATCH rather than PUT, because write() is a partial field merge and PUT would tell the server to replace the whole record.

Declare body or nothing is sent. An operation carries no request body unless one is declared, because operations differ in payload inside a single query and guessing a shape for one would send the wrong thing for another. body: item => item sends the item; body: item => ({ article: item }) wraps it for an envelope API. Development builds warn (WF-977) when an update or create is about to go out empty while the item has fields to send, since that request succeeds and changes nothing.

Named operations

Plenty of writes are not an update or a delete. A favorite toggle is two verbs on one sub-resource URL, and neither is derivable from the row. Give them names:

wildflower.query('feed', {
    from: '/api/articles',
    key: 'slug',
    to: {
        favorite:   { url: '/api/articles/:slug/favorite', method: 'POST',
                      confirmation: d => d.article },
        unfavorite: { url: '/api/articles/:slug/favorite', method: 'DELETE',
                      confirmation: d => d.article }
    }
});

wildflower.getQuery('feed').write('favorite', { slug: 'how-to-train', favorited: true });

A map declares exactly the operations it lists. Asking for one it does not have raises an error identifying the missing operation (WF-974) rather than quietly falling back to update, and nothing is sent. update and delete keep their meaning inside a map: an entry named delete is the lifecycle delete and applies your declared deleted field itself, so one entry cannot behave one way when derived and another when called by name.

Include the fields the operation changes, not just the key. A write carrying only the key claims nothing, so a rejection has nothing to roll back, and development builds warn with WF-976.

Creating rows

create is its own option rather than an entry in the map, because it is the one operation that creates a row rather than addressing an existing one. Its URL is the collection, and the query generates the temporary key for you:

wildflower.query('comments', {
    from: '/api/articles/:slug/comments',
    key: 'id',
    deleted: 'removed',
    params: () => ({ slug: wildflower.getStore('route').slug }),
    select: d => d.comments,

    to: { delete: { url: '/api/articles/:slug/comments/:id', method: 'DELETE' } },
    create: {
        url: '/api/articles/:slug/comments',
        method: 'POST',
        body: item => ({ comment: { body: item.body } }),
        confirmation: d => d.comment
    }
});

wildflower.getQuery('comments').create({ body: 'Nice write-up' });

The row appears immediately under a tmp- key, the server's record replaces it under the real key with no duplicate and no flicker, and a rejection removes the row that only ever existed optimistically. The generated key is never sent, since it is only local bookkeeping, so body: item => item will not post an id the server never issued. Pass your own key and it is used as given and sent like any other field, which is how a client-generated id against a PUT endpoint works.

Within that one query, the delete sends no body while the create sends an envelope, and :id comes from the item while :slug comes from params, both in the same URL. That is why body and confirmation are per-operation. The query-level ones apply to update and create; anything else declares its own. Declared params reach a write URL only through its :tokens. The query string they add to read requests is never appended to a write.

What comes back

confirmation extracts the server's answer for the row, and declaring it is what decides between reconciling and refetching. Declare it, and the response is parsed and applied as the row's new value. Leave it off, and an ok response means only that the request succeeded, so the query refetches to find out what was saved.

An ok response can mean three different things, and only the body can say which, so confirmation decides all three. It receives the parsed body and the item that was written:

confirmation: (body, item) => {
    if (!body.success) throw new Error(body.error);  // refused: reject and roll back
    if (body.row) return body.row;                   // here is the row: reconcile it
    return item;                                     // accepted, nothing to apply
}

Returning the item says the row is what you sent, so the optimistic value stands and no refetch follows. That is the answer for an endpoint that replies { success: true } and nothing more. It is a claim you are making about that endpoint, and it is wrong wherever the server transforms what it stores, by trimming a string, stamping a timestamp, clamping a number, or recomputing a total from the field you changed. On a create it is also wrong for the key, since the item carries the generated tmp- key and the row keeps it until the next fetch. Where any of that is true, return nothing and let the query fetch the truth.

A status code cannot make this decision on its own, which is why it is not a declared option. Plenty of APIs answer 200 with { success: false }, and telling that apart from a real success needs the body.

A successful response with no body at all is not an error. 204 No Content is the ordinary answer to a delete, and an empty body simply means there was nothing to apply, so the query refetches. The confirmation is not called in that case.

Writes

A query declares how data comes in with from. It declares how data goes out with to. Where the declarative form above cannot express a transport, to also takes a function that does the network call itself, and the query handles everything around it either way: showing the change immediately, tracking whether it's confirmed yet, and undoing it if the server says no. The function form is supported permanently, and a query can use it for reads while declaring its writes, or the reverse.

wildflower.query('orders', {
    from: '/api/orders',
    key: 'id',
    to: item => fetch('/api/orders', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(item)
    })
});

wildflower.component('order-form', {
    state: { draft: '' },
    addItem() {
        wildflower.getQuery('orders').write({ id: 'tmp-' + Date.now(), name: this.draft });
    }
});

Calling write(item) applies the item to the rows right away, so nobody waits on the round trip to see their own change, and the request goes out behind it. A keyed item merges into the row it names, and a key that matches nothing yet appends a new row, which is how the example above adds an order before the server has seen it. Optimistic Updates and Rollback covers that window in full, including what a rejection undoes.

A write to a list has to identify its row. An item with no key identifies none, so the write is rejected rather than guessing at one (WF-969). This depends on the query's shape and not on whether you spelled out key:, since key defaults to id: a query rendering a list is keyed either way. A record-shaped query is the other side of the same rule. It holds one record, so there is no row to identify and an unkeyed payload merges straight into it, and for the same reason create() on a record query is an error rather than a second record (WF-982). If one query supplies both a list and a record view, it counts as a list, because a list binding means its rows carry keys.

The write lifecycle: write({ id: 42, done: true }) applies on screen immediately and claims the done field, then your to: transport makes one request, which settles in one of three ways. A record reconciles the optimistic row against the server's. Nothing back, either because no confirmation is declared or because the transport resolved with nothing, costs one refetch. A rejection rolls back the fields that write still claims, leaving other writes' claims alone. A refetch that arrives mid-flight honors claims: fields owned by unsettled writes are not overwritten.

Telling the query what happened

Once your to function's promise settles, the query looks at what it resolved (or rejected) with to decide what happens next. There are three outcomes, and which one you get depends only on what you return.

Resolve with the saved record, and the query replaces the optimistic row with the real one, no second request needed. Parse the JSON body and hand it back:

to: item => fetch('/api/orders', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(item)
}).then(r => r.json())   // resolves with the record the server saved

This is the fast path. If the server assigned a real id, the temporary one you made up (tmp-1755...) gets swapped out for it automatically, and every other field on the row updates to match whatever the server actually stored.

Resolve with nothing, or leave off .then(r => r.json()) entirely, and the query invalidates and re-fetches to find out what really happened:

to: item => fetch('/api/orders', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(item)
})   // no .then() here: resolves with a raw Response, which the
     // query can't use as a record, so it triggers a refresh instead

A raw, un-parsed fetch() response counts as "nothing" as long as it's ok. The query can see that the request succeeded, but there is no record in it to apply directly, so it refetches instead. This is the simplest way to wire up to: skip the .then() and let the query do one extra read to stay correct.

The same "nothing" path also covers a resolved value that doesn't carry the query's key. If your API answers a save with a status envelope like { success: true } rather than the saved record, a keyed query has no id to match against, so it cannot use that as the row and falls back to refetching. Development builds warn about this (WF-965). If your API's response really does have the data you want applied directly, make sure the key is on it: return { ...body, id: item.id } when the response is missing the id you already know.

A resolved record follows JSON Merge Patch (RFC 7396). A field present with a value applies, overwriting the row's current value. A field present as null removes it from the row. A field the response simply doesn't mention is left exactly as it was. An endpoint can safely echo back only what it actually touched. A PATCH that confirms with { id, stock: 73 } updates stock and leaves every other field on the row untouched, no extra work required on your end:

to: changes => fetch('/api/orders/' + changes.id, {
    method: 'PATCH',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(changes)
}).then(r => r.json())   // { id: 42, stock: 73 }; other fields on the row are untouched

To clear a field, resolve with it set to null explicitly, since an omitted field leaves the row's current value alone.

Reject, and the optimistic change rolls back. A raw fetch() response that comes back not-ok (a 4xx or 5xx status) is treated as a rejection automatically, in the shape HTTP <status>, the same error shape a failed read uses, so you do not have to check r.ok and throw yourself:

to: item => fetch('/api/orders', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(item)
})
// a 400 or 500 response here rejects on its own as "HTTP 400" / "HTTP 500"

Two decisions produce those three outcomes: whether you parse the response (fast path or refetch), and whether the server accepted the write at all (success or rollback). Returning the parsed record saves a round trip when your API supports it; returning nothing is simpler to write and just as correct, since the query fetches its own confirmation either way.

Returning nothing has one cost worth knowing about if you run read replicas or a cache in front of your API: the refetch can answer from a machine that has not caught up with the save yet. Declaring a confirmation avoids the round trip entirely, so the problem does not arise. The refetch race covers what the query can and cannot tell apart there.

When the server says no

write() returns a promise that rejects on failure, so an ordinary try/catch around it works as you'd expect. The failure shows up in syncError rather than error, which is reserved for a failed first load, and the rows stay on screen either way, so nothing goes blank.

The optimistic change is undone field by field, and only for the fields that write still owns, so two writes in flight on one row fail independently. Optimistic Updates and Rollback covers the claim rules and what a rejected create or delete does.

Deletes

Deletes need one extra declaration on the query: the name of a field that marks a row as deleted. Once that is in place, a delete is a write like any other. A row carrying a truthy value in that field is removed from the list instead of merged into it, and your to function sees that same field, so one function can route creates, updates, and deletes at once:

wildflower.query('orders', {
    from: '/api/orders',
    key: 'id',
    deleted: 'deleted',
    to: item => item.deleted
        ? fetch('/api/orders/' + item.id, { method: 'DELETE' })
        : fetch('/api/orders', { method: 'POST', body: JSON.stringify(item) })
});

// The row leaves the screen now; the DELETE request catches up behind it.
wildflower.getQuery('orders').write({ id: 42, deleted: true });

Without a deleted declaration on the query, a truthy value in that field merges in as ordinary row data and nothing is removed. Calling write() on a query that never declared to rejects (WF-964), since there would be nowhere for the write to go. Every write() and create() failure rejects the returned promise, so one .catch sees them all.

The same applies when you call the delete by name. write('delete', { id: 42 }) against a to map sends the request whether or not deleted is declared, but only a declared tombstone field removes the row on screen. Without one the request succeeds, the server drops the record, and the row sits there until the next sync fetches a list that no longer contains it, which reads as a delete button that does nothing for a second or two. Development builds warn when it happens (WF-975). Declare deleted alongside the map and the named delete removes the row immediately, exactly as the derived one does.

Here is everything above in one place, against a simulated server with real latency. Tick a task and the change appears before the save settles. Flip the switch and try again: the server refuses, and exactly the written field rolls back. Delete with the switch on, and the row comes back.

<div data-component="write-demo">
    <div class="form-check form-switch mb-2">
        <input class="form-check-input" type="checkbox" id="wd-arm"
               data-action="change:setArm">
        <label class="form-check-label" for="wd-arm">server rejects saves</label>
    </div>

    <ul class="list-group" data-query="writes-demo">
        <template>
            <li class="list-group-item d-flex align-items-center gap-2">
                <button class="btn btn-sm btn-outline-secondary" data-action="toggleDone"
                        data-bind="mark"></button>
                <span data-bind="title" data-bind-class="rowClass"></span>
                <button class="btn btn-sm btn-outline-danger ms-auto"
                        data-action="remove">delete</button>
            </li>
        </template>
    </ul>

    <p class="small text-muted mt-2 mb-0" data-bind="status"></p>
</div>
// The demo server: three rows in memory behind ~900ms of latency, and
// a switch that makes it refuse saves. One `to` routes updates and
// deletes alike — no fetch mocking, just a function source.
let rows = [
    { id: 1, title: 'Water the seed trays', done: true },
    { id: 2, title: 'Label the new beds',   done: false },
    { id: 3, title: 'Fix the drip line',    done: false }
];
let rejectSaves = false;
const wait = ms => new Promise(r => setTimeout(r, ms));

wildflower.query('writes-demo', {
    from: () => rows.map(r => ({ ...r })),
    key: 'id',
    deleted: 'removed',
    to: async item => {
        await wait(900);
        if (rejectSaves) throw new Error('HTTP 409');
        if (item.removed) {
            rows = rows.filter(r => r.id !== item.id);
            return;                       // nothing: the query refetches
        }
        rows = rows.map(r => r.id === item.id ? { ...r, ...item } : r);
        return rows.find(r => r.id === item.id);   // the saved record
    }
});

wildflower.component('write-demo', {
    state: { status: 'Every change lands on screen first; the save follows.' },

    computed: {
        // Item-level computeds: fn(item) evaluates per row.
        mark(item) { return item.done ? '☑' : '☐'; },
        rowClass(item) {
            return item.done ? 'text-decoration-line-through text-muted' : '';
        }
    },

    setArm(event) { rejectSaves = event.target.checked; },

    toggleDone(event, element, details) {
        const t = details.item;
        this.report(
            wildflower.getQuery('writes-demo').write({ id: t.id, done: !t.done }),
            (t.done ? 'reopen' : 'complete') + ' “' + t.title + '”'
        );
    },

    remove(event, element, details) {
        this.report(
            wildflower.getQuery('writes-demo').write({ id: details.item.id, removed: true }),
            'delete “' + details.item.title + '”'
        );
    },

    // write() returns a promise: confirmation and rollback are both
    // observable, so the demo narrates them.
    report(saving, label) {
        this.status = 'Saving — ' + label + '…';
        saving.then(
            () => { this.status = 'Confirmed — ' + label; },
            () => { this.status = 'Rejected — ' + label + ' — rolled back.'; }
        );
    }
});
Live Preview

The transport is an in-memory function, and the write path does not depend on that. Swap the function body for a fetch() and the behavior on screen is identical. The query handles the optimistic apply and the rollback, and your to makes one request.

One entity in two queries

Queries are independent stores, each with its own copy of whatever rows it holds. So when the same server entity shows up in two different queries, say an order detail view and an order list, each query keeps its own copy with its own claims, and a write through one leaves the other's copy alone until that second query happens to refresh on its own schedule. The alternative would be a normalized cache, which why two queries do not share a row works through.

The cost is lag. Save through a detail query, and a list query showing the same row keeps its old values until its next refresh. When two views need to agree immediately, invalidate the sibling once the write has settled:

await wildflower.getQuery('order-detail').write({ id: 42, status: 'shipped' });
wildflower.getQuery('orders').invalidate();   // the list catches up now

// several siblings at once
await wildflower.invalidateQueries('orders', 'dashboard-counts');

wildflower.invalidateQueries() takes any number of query names, invalidates each, and returns a promise that resolves once every triggered refetch has settled, so a write flow can await the whole convergence. Queries nothing is currently observing are skipped rather than activated; an inactive query always revalidates when its next observer arrives, so there is nothing to catch up. A name that matches no registered query warns in dev builds (WF-955) and the rest still run.

What this asks of you as the app grows

Keeping that list of names current is your job, and it is the cost of queries that do not share a cache. Six months from now you add a third view of the same entity, an order summary card beside the list and the detail. Every write that touches an order now needs the new query's name added to it. If you miss one, that view shows old values until its own next refresh, and nothing tells you. There is no error, warning, or failed request to find in the network tab, because from the framework's side nothing went wrong.

How much this costs depends on how many views of the same records are on screen at the same time, which is usually a small number. Applications organized around pages or routes rarely feel it at all, since a detail page and a list page are seldom open together, and a query nothing is showing revalidates by itself when something finally shows it. The case that needs attention is a dense dashboard, where several panels over the same records are visible at once because that is what a dashboard is for.

Put the invalidateQueries call directly after the write it follows rather than burying it in a helper, so the list of names is visible at the one place you would ever need to update it. When you are unsure whether a query belongs in that list, include it. An unnecessary invalidation costs one conditional request that usually comes back 304 Not Modified with no body, while a missing one is the silent staleness above.

Where to Next

Optimistic Updates and Rollback covers what a write puts on screen before the server answers: the claim rules that decide what a failure undoes, the pendingWrites count for saving indicators, what a page unload costs an unsent write, and patch() for adding the same optimism by hand when the query cannot own the transport.

Boundaries and Guarantees collects the rules a query follows at its boundaries: the races it will not guess at, the limits of the credential scope, and why writes never retry.

Full Optimistic Tasks

Declarative writes against a server with an added delay. A server-computed work estimate comes from an async computed, and persisted rows paint instantly on reload.