Skip to content

fix: keep a zero boost in the query builder - #112

Merged
ytkimirti merged 11 commits into
DX-3147-qb-emptyfrom
DX-3147-qb-boost
Nov 24, 2026
Merged

ytkimirti merged 11 commits into
DX-3147-qb-emptyfrom
DX-3147-qb-boost

Conversation

@ytkimirti

Copy link
Copy Markdown
Collaborator

Bug: Setting a boost of 0 in the Query Builder has no effect: the boost is dropped from the query, and the Boost switch, which shows as on, sets the boost to 2 instead of turning it off. The serializer checked boost && boost !== 1 and the menu node.boost ? ... : ..., both treating 0 as unset.
Fix: Treat a boost as set whenever it is defined and not 1 (hasBoost), and toggle the switch on node.boost === undefined.

Why each change

  • components/databrowser/components/ui-query-builder/query-stringify.ts: hasBoost replaces every truthiness check, so conditions, merged objects, groups and negated OR groups all keep a 0 boost; 1 is still omitted since it is the server default.
  • components/databrowser/components/ui-query-builder/query-stringify.ts: the condition shorthand now also uses hasBoost, so a boost of 1 writes { name: "foo" } instead of the long form without the boost, and a boost of 0 no longer collapses to the shorthand.
  • components/databrowser/components/ui-query-builder/node-actions-menu.tsx: matches the condition the switch already uses for its on/off state, so clicking it on a 0 boost turns it off.
  • components/databrowser/components/ui-query-builder/query-roundtrip.test.ts: locks in that a 0 boost survives on conditions and groups and that a boost of 1 is written as the shorthand.

Repro: In the Query Builder, enable Boost on a condition and set it to 0: the Code Editor shows the condition without $boost; clicking the Boost switch again sets it to 2 instead of removing it.

Part of DX-3147

@vercel

vercel Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
react-redis-browser Ready Ready Preview Nov 17, 2026 4:43pm UTC

Request Review

@linear-code

linear-code Bot commented Oct 15, 2026

Copy link
Copy Markdown

DX-3147

@ytkimirti
ytkimirti marked this pull request as ready for review October 22, 2026 11:33
@ytkimirti
ytkimirti added this pull request to stack #118 October 28, 2026 07:55
@ytkimirti
ytkimirti merged commit 828ef5e into master Nov 24, 2026
5 checks passed
@ytkimirti
ytkimirti deleted the DX-3147-qb-boost branch November 24, 2026 10:14

This branch was successfully deployed

1 active deployment
Preview — ab7cbec0 Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants