Repository navigation
Grok repo idiomaticity review #4
Copy link
Copy link
Open
Description
Code review findings
Review of main (package svelte-querybuilder @ 0.1.1) against the stated goal: idiomatic Svelte 5 UI on @react-querybuilder/core, with query/DOM parity and a Svelte-shaped API.
Packaging / dependency
@react-querybuilder/coreis resolved via a pkg.pr.new URL (...@3d5d992), not a stable npm version range. Unsuitable for consumers and for reproducible installs once published more widely. Pin to a released version (or an explicit range) and document the upgrade path.- Package version is
0.1.1while the public surface (controls, props, re-exports of core, history API) is large. No explicit stability / 1.0 criteria in README or docs.
Types and any
- Remaining
any/ loose bridges:getSubQueryBuilderPropsreturn typed asany- action handlers with optional
context?: any Control.svelteprops typed asany- several
as unknown ascasts where core string identifiers meet stricter generics
- Prefer narrower types or localized generics so public and internal call sites stay checkable without casts.
Maintainability
RuleComponents.svelteconcentrates many getter-backed prop bags plus conditional control markup in one file. Prop-bag construction could be moved to small helpers (same pattern aswithCommonProps) to reduce density without changing behavior.- Empty HTML comment joiners between sibling controls are required for DOM text parity with React fixtures. They are documented in
AGENTS.mdand comments; still easy to “clean up” in a formatter pass. Consider a short CONTRIBUTING note or a conformance failure message that points at this constraint.
Reactivity edge cases
createValueEditorResetis the main$effect-style path (timing for value reset on operator/type change). Keep dedicated tests on that path so behavior does not regress relative to core.- Documented constraint: rebuilding
queryas a new object every read (e.g.query={{ ...q }}) reverts edits. Worth a short “reactivity gotchas” subsection (stable query reference, getter context, getter-backed control props) aimed at advanced consumers and custom controls.
Core alignment / future-proofing
- Compile-time guard accounts for core control keys not implemented here (
dragHandle,ruleGroupBodyElements,ruleGroupHeaderElements). A CI check against core’s exported key list would make upgrades fail loudly when core adds keys. enableDragAndDropis forced false; root always emitsdata-dnd="disabled". Consistent with non-goals; no change needed unless the non-goal list changes.
Tooling
check:exports(attw + specifier lint) and deletion of test artifacts fromdistare present. Keep both in the release path so Node ESM consumers and published tarballs stay clean.- SSR is gated via
examples/sveltekit(test:ssr). Treat as a hard CI requirement; do not drop when iterating on the library package alone.
Docs
docs/differences-from-react-querybuilder.mdcovers intentional API divergences. Gaps relative to implementation detail:- stable
queryreference requirement (already in README warning; easy to miss) - why control props are getter-backed
- context-as-getter requirement for nested / subquery builders
- stable
- No explicit list of what would block a 1.0 (API freeze, core version policy, remaining non-goals).
Suggested follow-ups (priority)
- Replace pkg.pr.new core dependency with a stable npm version/range.
- Tighten or document remaining
any/ cast sites. - Split prop-bag construction out of
RuleComponents(optional refactor). - Add reactivity gotchas + 1.0 / core-pin policy to docs.
- Optional CI: assert implemented control keys against core’s
controlKeys/controlKind.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
jakeboone02 commentedon Sep 26, 2026
Will be addressed in in 0.2.0 (see #5):
Packaging: core is already
^8.24.3from npm, not pkg.pr.new. There's a new README section, "Stability and versioning", covering pre-1.0 semantics, the core version policy (core minor and conformance tag move together) and what blocks 1.0. The version bump happens at release.Types:
getSubQueryBuilderPropsnow returns a namedSubQueryBuilderPropstype. Everycontextisunknowninstead ofany(breaking).Control.svelteis generic over the control's props, so each call site is type-checked; this caught a realvalueSourcetyping bug inMatchModeEditor. Casts inRuleSubQuery,rulePartsandValueEditorare removed. The remaininganys mirror core'sRuleType.valueand are commented as such.RuleComponents density: declined. Prop bags already go through
withCommonProps, which is the pattern you suggested. Moving them into another module adds indirection without making anything clearer.Joiners: conformance failures caused only by whitespace in an element's text now point to the
<!-- -->joiners and the AGENTS.md pitfall. No CONTRIBUTING.md; AGENTS.md plus the failure message covers it.Value-editor reset: already covered (8 dedicated tests in
valueEditorEffect.svelte.test.ts, plusresetScalingandValueEditortests). No change.Reactivity gotchas: new
docs/reactivity.md. Context-as-getter was already incustomization.mdand is now linked from the new page.Control keys: a compile-time guard already failed
svelte-checkwhen core added a key. A runtime test now also checks against core'scontrolKeys/controlKind.Also: a test caps
$effectuse insrc/libto an allow-list. DnD,check:exportsandtest:ssrare unchanged; all already run in CI andcheck:all.