Skip to content

[LIG-10245] Add grouped sample-tag counts query hook#1693

Draft
ikondrat wants to merge 1 commit into
kondrat-lig-10238-backend-batch-class-counts-by-selected-sample-tagsfrom
kondrat-lig-10245-frontend-grouped-sample-tag-counts-query-hook
Draft

[LIG-10245] Add grouped sample-tag counts query hook#1693
ikondrat wants to merge 1 commit into
kondrat-lig-10238-backend-batch-class-counts-by-selected-sample-tagsfrom
kondrat-lig-10245-frontend-grouped-sample-tag-counts-query-hook

Conversation

@ikondrat

Copy link
Copy Markdown
Contributor

Summary

  • add a typed TanStack Query hook for the grouped sample-tag annotation-count endpoint
  • build requests from collection ID, ordered sample tag IDs, the complete image filter, annotation type, and count mode
  • keep grouped queries under the existing annotation-count cache-key prefix so annotation mutations invalidate both views
  • disable grouped fetching for empty tag selections
  • preserve previous grouped data during reactive key transitions and forward request cancellation
  • export the hook through the public hooks barrel

Why

The distribution panel needs one reactive request per annotation-type view, not one request per selected tag. Keeping every request dimension in the key prevents stale results when filters, count mode, annotation type, or tag order changes.

This is split from LIG-10239 to keep the query/cache behavior independently reviewable and below the requested 150-line threshold.

Stack

Testing

Generate the local API client from the stacked backend schema, then run frontend checks:

cd lightly_studio
.venv/bin/python src/lightly_studio/export_schema.py
cd ../lightly_studio_view
npm run generate-api-client
make static-checks

Validated locally with Node 24.13.1: Prettier, ESLint, TypeScript, and Svelte diagnostics all pass.

Focused query-key/request tests are added in the dedicated LIG-10241 coverage stack.

Linear

LIG-10245

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8014038e-fa52-41de-ae79-6dff238dda50

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kondrat-lig-10245-frontend-grouped-sample-tag-counts-query-hook

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant