Skip to content

feat(website): replace plain textarea in VariantEditor with validated AdvancedQueryFilter#1197

Open
fhennig wants to merge 7 commits into
mainfrom
collections-adv-query-validated
Open

feat(website): replace plain textarea in VariantEditor with validated AdvancedQueryFilter#1197
fhennig wants to merge 7 commits into
mainfrom
collections-adv-query-validated

Conversation

@fhennig
Copy link
Copy Markdown
Contributor

@fhennig fhennig commented May 5, 2026

depends on #1195

Summary

  • Replaces the plain <textarea> in the collection variant editor's advanced query mode with the validated AdvancedQueryFilter component
  • Restricts users to lineage fields only (using the existing lineageFields config, already passed to VariantEditor)
  • No config changes needed — lineageFields doubles as the allowed fields list; when empty, no restriction is applied

Test plan

  • Manually test: open the collection edit UI, enable "Use advanced query instead", type a lineage query (e.g. BA.1*) — should show checkmark
  • Type a query referencing a disallowed field (e.g. host:Human) — should show error with field name and allowed list
  • Type a mutation query (e.g. A123T) — should pass (no metadata columns referenced)
  • Existing VariantEditor browser spec tests pass

🤖 Generated with Claude Code

fhennig and others added 6 commits May 5, 2026 08:42
Required by verbatimModuleSyntax.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…yFilter

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… AdvancedQueryFilter

The advanced query mode in the collection variant editor now uses the
same validated query input as the baseline filter, restricting users to
lineage fields only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

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

Project Deployment Actions Updated (UTC)
dashboards Ready Ready Preview, Comment May 5, 2026 9:17am

Request Review

@fhennig fhennig changed the base branch from main to adv-query-allowed-fields May 5, 2026 09:10
@fhennig fhennig self-assigned this May 5, 2026
@fhennig fhennig requested a review from fengelniederhammer May 5, 2026 09:11
…spec

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the collection variant editor’s “advanced query” mode to use the existing validated AdvancedQueryFilter UI instead of a plain <textarea>, and wires it to restrict referenced metadata fields to the configured lineageFields.

Changes:

  • Replaced the query variant <textarea> with AdvancedQueryFilter (validated, with field allowlisting).
  • Plumbed lapisUrl into VariantEditor so AdvancedQueryFilter can validate against LAPIS.
  • Updated VariantEditor browser specs to wrap with a React Query provider and pass lapisUrl.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
website/src/components/collections/form/VariantEditor.tsx Replaces query textarea with AdvancedQueryFilter, adds lapisUrl prop, and maps lineageFieldsallowedFields.
website/src/components/collections/form/VariantEditor.browser.spec.tsx Wraps VariantEditor with a QueryClientProvider for tests and provides a dummy LAPIS URL.
website/src/components/collections/form/CollectionForm.tsx Passes lapisUrl down into VariantEditor.
Comments suppressed due to low confidence (1)

website/src/components/collections/form/VariantEditor.tsx:87

  • onInput updates the parent variant using the variant value from the render closure. Since AdvancedQueryFilter invokes onInput asynchronously (debounced + network validation), this can overwrite newer edits to other fields (e.g., name/description) made before validation completes. Use variantRef.current (or another up-to-date source) when constructing the next variant object to avoid clobbering concurrent changes.
                        lapisUrl={lapisUrl}
                        value={variant.countQuery}
                        allowedFields={lineageFields.length > 0 ? lineageFields : undefined}
                        onInput={(newValue) => onChange(index, { ...variant, countQuery: newValue ?? '' })}
                    />

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +81 to +87
<AdvancedQueryFilter
enabled
lapisUrl={lapisUrl}
value={variant.countQuery}
allowedFields={lineageFields.length > 0 ? lineageFields : undefined}
onInput={(newValue) => onChange(index, { ...variant, countQuery: newValue ?? '' })}
/>
@fhennig fhennig force-pushed the adv-query-allowed-fields branch from 1bf81f3 to 142a533 Compare May 17, 2026 12:28
Base automatically changed from adv-query-allowed-fields to main May 17, 2026 13:15
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