Skip to content

Send image embedding-plot selection as geometry#1587

Merged
ikondrat merged 1 commit into
mainfrom
kondrat/lig-9903-4-images-frontend
Jul 8, 2026
Merged

Send image embedding-plot selection as geometry#1587
ikondrat merged 1 commit into
mainfrom
kondrat/lig-9903-4-images-frontend

Conversation

@ikondrat

@ikondrat ikondrat commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What has changed and why?

Image embedding-plot lasso/rectangle selections are now stored and sent to the backend as region geometry (embedding_region) instead of a resolved list of sample_ids. The backend resolves the polygon to sample ids server-side, so the request body stays small and constant-size regardless of how many items are selected.

Key pieces:

  • New shared plumbinguseEmbeddingPlotSelection (a per-collection selection-count store: setPlotSelectionCount / clearPlotSelectionCount / getPlotSelectionCount) and useRegionFilterVisibility, which drives the sidebar chip's count/visibility from the plot-propagated count rather than a resolved id list. Clearing the filter removes the region entirely (geometry has no separate "hidden"/restore state).
  • useImageFilters — adds updateEmbeddingRegion(...) to set/clear only the region in the existing filter params, and threads embedding_region into the derived imageFilter sent to the API.
  • Request/type wiringembedding_region is added to NormalModeFilters, buildRequestBody, and the external-filter sync (syncFilterParams) so the region is excluded from base-param comparison and carried forward across collections alongside sample_ids.
  • useEmbeddingFilterForImages — switched from the sample_ids-based useFilterVisibility to the new useRegionFilterVisibility.

How has it been tested?

Unit tests updated/added:

  • useEmbeddingPlotSelection.test.ts — per-collection count isolation, defaults, set/clear.
  • useEmbeddingFilter.test.ts — chip visibility/count now driven by propagated plot-selection count; setVisibility(false) / clearFilter clear the region and call setRangeSelection.
  • useImagesInfinite.test.tsembedding_region geometry is propagated to sample_filter, and omitted when no region is selected.
  • syncFilterParams.test.tsembedding_region treated as an external filter and carried forward across collections.

Did you update CHANGELOG.md?

  • Yes
  • Not needed (internal change)

Summary by CodeRabbit

  • New Features

    • Lasso and region selections now work consistently across images and annotations, with selection state preserved as highlighted regions.
    • Selection counts are now tracked per collection, improving visibility of active filters.
  • Bug Fixes

    • Fixed selection handling so clearing or switching collections resets the correct region state.
    • Improved filter syncing so region-based selections remain accurate when navigating or reloading.
    • Select-all behavior now respects annotation regions instead of only item lists.

@ikondrat ikondrat requested a review from a team as a code owner July 6, 2026 12:51
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 499b2850-65f0-419e-8ef1-bdea20bddca6

📥 Commits

Reviewing files that changed from the base of the PR and between dd81371 and ff1d2f3.

📒 Files selected for processing (22)
  • lightly_studio_view/src/lib/components/AnnotationsGrid/AnnotationsGrid.svelte
  • lightly_studio_view/src/lib/components/Images/syncFilterParams.test.ts
  • lightly_studio_view/src/lib/components/Images/syncFilterParams.ts
  • lightly_studio_view/src/lib/components/PlotPanel/PlotPanel.svelte
  • lightly_studio_view/src/lib/components/PlotPanel/PlotPanel.test.ts
  • lightly_studio_view/src/lib/components/PlotPanel/usePlotData/usePlotData.test.ts
  • lightly_studio_view/src/lib/components/PlotPanel/usePlotData/usePlotData.ts
  • lightly_studio_view/src/lib/hooks/useAnnotationsInfinite/createAnnotationsInfiniteOptions.test.ts
  • lightly_studio_view/src/lib/hooks/useAnnotationsInfinite/createAnnotationsInfiniteOptions.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingFilter.test.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingFilterForAnnotations.test.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingFilterForAnnotations.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingFilterForImages.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingPlotSelection.test.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingPlotSelection.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useRegionFilterVisibility.ts
  • lightly_studio_view/src/lib/hooks/useImageFilters/useImageFilters.ts
  • lightly_studio_view/src/lib/hooks/useImagesInfinite/buildRequestBody.ts
  • lightly_studio_view/src/lib/hooks/useImagesInfinite/types.ts
  • lightly_studio_view/src/lib/hooks/useImagesInfinite/useImagesInfinite.test.ts
  • lightly_studio_view/src/lib/hooks/useSelectAll/useSelectAll.ts
  • lightly_studio_view/src/routes/datasets/[dataset_id]/[collection_type]/[collection_id]/+layout.svelte
✅ Files skipped from review due to trivial changes (1)
  • lightly_studio_view/src/lib/hooks/useImagesInfinite/buildRequestBody.ts
🚧 Files skipped from review as they are similar to previous changes (21)
  • lightly_studio_view/src/routes/datasets/[dataset_id]/[collection_type]/[collection_id]/+layout.svelte
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingPlotSelection.test.ts
  • lightly_studio_view/src/lib/hooks/useAnnotationsInfinite/createAnnotationsInfiniteOptions.ts
  • lightly_studio_view/src/lib/hooks/useImagesInfinite/useImagesInfinite.test.ts
  • lightly_studio_view/src/lib/components/Images/syncFilterParams.ts
  • lightly_studio_view/src/lib/components/Images/syncFilterParams.test.ts
  • lightly_studio_view/src/lib/hooks/useImagesInfinite/types.ts
  • lightly_studio_view/src/lib/components/AnnotationsGrid/AnnotationsGrid.svelte
  • lightly_studio_view/src/lib/hooks/useAnnotationsInfinite/createAnnotationsInfiniteOptions.test.ts
  • lightly_studio_view/src/lib/components/PlotPanel/usePlotData/usePlotData.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useRegionFilterVisibility.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingPlotSelection.ts
  • lightly_studio_view/src/lib/components/PlotPanel/usePlotData/usePlotData.test.ts
  • lightly_studio_view/src/lib/hooks/useImageFilters/useImageFilters.ts
  • lightly_studio_view/src/lib/hooks/useSelectAll/useSelectAll.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingFilter.test.ts
  • lightly_studio_view/src/lib/components/PlotPanel/PlotPanel.svelte
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingFilterForImages.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingFilterForAnnotations.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingFilterForAnnotations.test.ts
  • lightly_studio_view/src/lib/components/PlotPanel/PlotPanel.test.ts

📝 Walkthrough

Walkthrough

Frontend embedding-plot selection is reworked to persist and consume lasso/rectangle region geometry (embedding_region) instead of resolved sample-id lists, for both images and annotations. New selection-count and region-visibility hooks drive chip visibility, and PlotPanel, AnnotationsGrid, filter hooks, query builders, and layout cleanup are updated accordingly.

Changes

Embedding region filter feature (frontend)

Layer / File(s) Summary
Plot selection count store and region visibility hook
useEmbeddingFilter/useEmbeddingPlotSelection.ts, useEmbeddingFilter/useEmbeddingPlotSelection.test.ts, useEmbeddingFilter/useRegionFilterVisibility.ts
New per-collection selection-count store (set/get/clear) and a useRegionFilterVisibility hook deriving visibility from that count and clearing region/backend selection.
Annotation and image filter hooks switched to region state
useEmbeddingFilterForAnnotations.ts, useEmbeddingFilterForAnnotations.test.ts, useEmbeddingFilterForImages.ts, useEmbeddingFilter.test.ts
Annotation selection state moves from sample-id arrays to annotationPlotRegion/saveRegion; clearAnnotationPlotSelection now requires collectionId; both image and annotation filters now use useRegionFilterVisibility.
Image query params and filter merge wired to embedding_region
useImageFilters.ts, useImagesInfinite/types.ts, useImagesInfinite/buildRequestBody.ts, useImagesInfinite/useImagesInfinite.test.ts, Images/syncFilterParams.ts, Images/syncFilterParams.test.ts
updateEmbeddingRegion added to useImageFilters; NormalModeFilters picks up embedding_region; syncFilterParams excludes/merges embedding_region like other external filters.
Annotations infinite query wired to embedding_region
createAnnotationsInfiniteOptions.ts, createAnnotationsInfiniteOptions.test.ts
embedding_region added to the queryKey and request body sent for annotations.
PlotPanel region-based selection commit/clear flow
PlotPanel/PlotPanel.svelte, PlotPanel/PlotPanel.test.ts, usePlotData/usePlotData.ts, usePlotData/usePlotData.test.ts
PlotPanel commits/clears region geometry for images/annotations via new saveRegion/commitRegion/clearRegion helpers, derives committedHighlightRegion, and passes highlightRegion into usePlotData for category highlighting.
AnnotationsGrid, select-all, and layout cleanup using region
AnnotationsGrid.svelte, useSelectAll.ts, [collection_id]/+layout.svelte
AnnotationsGrid queries and loader identifiers use embedding_region instead of sample ids; useSelectAll stamps annotation snapshots with embedding_region; layout clears annotation plot selection scoped by collection.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

  • lightly-ai/lightly-studio#1585: Backend addition of SampleFilter.embedding_region and server-side resolution directly matches this PR's frontend switch to sending region geometry.
  • lightly-ai/lightly-studio#1520: Touches the same annotations embedding-plot flow (AnnotationsGrid/PlotPanel selection wiring) that this PR converts from sample_ids to region geometry.
  • lightly-ai/lightly-studio#829: Modifies the same PlotPanel embeddings query filter construction (sample_ids handling) that this PR reworks around embedding_region.

Suggested reviewers: LeonardoRosaa

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: sending image embedding-plot selection as geometry.
Description check ✅ Passed The description follows the required template and covers the change, testing, and changelog status.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kondrat/lig-9903-4-images-frontend

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a37412f2d4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ikondrat ikondrat changed the title Send image embedding-plot selection as geometry (LIG-9903) Send image embedding-plot selection as geometry Jul 6, 2026
@ikondrat

ikondrat commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

/review

1 similar comment
@ikondrat

ikondrat commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

/review

Base automatically changed from kondrat/lig-9903-3-annotations-backend to main July 8, 2026 11:07
commit dd81371
Merge: c03eca0 b24059a
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Wed Jul 8 13:11:04 2026 +0200

    Merge branch 'main' into kondrat/lig-9903-4-images-frontend

commit c03eca0
Author: Kondrat Shmoylov <kondrat.shmoylov@gmail.com>
Date:   Tue Jul 7 17:35:39 2026 +0200

    Frontend: Filter annotations by embedding-plot region selection  (#1588)

    Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

commit 0393302
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Tue Jul 7 13:52:36 2026 +0200

    update

commit 0e75379
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Tue Jul 7 13:50:32 2026 +0200

    show selected items in the plot as well

commit 6848049
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 18:21:12 2026 +0200

    fix

commit 6e398bf
Merge: a37412f 7ba06d7
Author: Kondrat Shmoylov <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 17:11:02 2026 +0200

    Merge branch 'kondrat/lig-9903-3-annotations-backend' into kondrat/lig-9903-4-images-frontend

commit 7ba06d7
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 16:48:45 2026 +0200

    fix

commit 2139ecc
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 16:47:35 2026 +0200

    Extract the embedding-region predicate

commit 2693590
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 16:45:16 2026 +0200

    mport SQLAlchemy functions through the module

commit 34a2209
Merge: 3b79ec5 70fbd8a
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 16:42:09 2026 +0200

    Merge branch 'kondrat/lig-9903-2-images-backend' into kondrat/lig-9903-3-annotations-backend

commit 70fbd8a
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 16:32:44 2026 +0200

    Import SQLAlchemy functions through the module

commit 44c39db
Merge: 6ac2bf8 6b18b5f
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 16:26:53 2026 +0200

    Merge branch 'kondrat/lig-9903-1-shared-region-model' into kondrat/lig-9903-2-images-backend

commit 6b18b5f
Merge: 8db9535 1afef78
Author: Kondrat Shmoylov <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 16:22:00 2026 +0200

    Merge branch 'main' into kondrat/lig-9903-1-shared-region-model

commit 8db9535
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 16:17:54 2026 +0200

    move helper functions to bottom

commit 9ae5cdf
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 16:15:38 2026 +0200

    use float32

commit 95a27f4
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 16:13:22 2026 +0200

    update

commit 7c44af9
Merge: 3401e5b b5e335e
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 16:05:22 2026 +0200

    Merge branch 'kondrat/lig-9903-1-shared-region-model' of github.com:lightly-ai/lightly-studio into kondrat/lig-9903-1-shared-region-model

commit 3401e5b
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 16:05:18 2026 +0200

    fix the test

commit b5e335e
Merge: 77cda6e 3b4e509
Author: Kondrat Shmoylov <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 15:43:25 2026 +0200

    Merge branch 'main' into kondrat/lig-9903-1-shared-region-model

commit 77cda6e
Merge: 06dd19c 3d1754d
Author: Kondrat Shmoylov <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 15:36:33 2026 +0200

    Merge branch 'main' into kondrat/lig-9903-1-shared-region-model

commit 6ac2bf8
Merge: 41d3e9c 06dd19c
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 15:24:35 2026 +0200

    Merge branch 'kondrat/lig-9903-1-shared-region-model' into kondrat/lig-9903-2-images-backend

commit 06dd19c
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 15:21:38 2026 +0200

    Add a tie-breaker to guarantee determinism on equal created_at.

commit 065fd41
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 15:17:32 2026 +0200

    update

commit dfb968d
Merge: 702067b 502dc9d
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 15:15:55 2026 +0200

    Merge branch 'kondrat/lig-9903-1-shared-region-model' of github.com:lightly-ai/lightly-studio into kondrat/lig-9903-1-shared-region-model

commit 702067b
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 15:15:02 2026 +0200

    Use keyword arguments for square bounds

commit ff67f0a
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 15:13:02 2026 +0200

    Declare the polygon length constraint in the field

commit 56d19f5
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 15:05:34 2026 +0200

    Make embedding-model selection deterministic

commit 502dc9d
Merge: 60aa87f 054c7d4
Author: Kondrat Shmoylov <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 14:53:23 2026 +0200

    Merge branch 'main' into kondrat/lig-9903-1-shared-region-model

commit a37412f
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 14:43:50 2026 +0200

    Send image embedding-plot selection as geometry (LIG-9903)

    Store the image lasso/rectangle selection as region geometry instead of
    a resolved sample-id list and send it to the backend. Adds the shared
    region-selection plumbing (useEmbeddingPlotSelection count store and
    useRegionFilterVisibility) plus updateEmbeddingRegion on the image
    filter store, and threads embedding_region through the request body,
    types, and external-filter sync.

    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

commit 3b79ec5
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 14:42:49 2026 +0200

    Filter annotations by embedding-plot region selection (LIG-9903)

    Mirror the image behaviour for the annotations grid: AnnotationsFilter
    gains an optional embedding_region resolved server-side to annotation
    sample ids, and the annotation resolvers plus the read-with-payload
    route wire in the resolver. An empty region matches nothing.

    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

commit 41d3e9c
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 14:42:18 2026 +0200

    Filter images by embedding-plot region selection (LIG-9903)

    Add an optional embedding_region to SampleFilter, resolved server-side
    to sample ids before the filter is applied. The image resolvers
    (get_all, get_sample_ids, annotation counts) call the resolver so a
    lasso/rectangle selection narrows the grid without the client sending
    the full selected sample-id list. An empty region matches nothing.

    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

commit 60aa87f
Author: ikondrat <kondrat.shmoylov@gmail.com>
Date:   Mon Jul 6 14:40:50 2026 +0200

    Add embedding-region model and point-in-polygon core (LIG-9903)

    Shared foundation for filtering both images and annotations by an
    embedding-plot lasso/rectangle selection. The frontend sends the region
    geometry (a few vertices) instead of the full list of selected sample
    ids, and the backend resolves it to sample ids via a vectorized
    point-in-polygon test over the cached 2D projection.

    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ikondrat ikondrat force-pushed the kondrat/lig-9903-4-images-frontend branch from dd81371 to ff1d2f3 Compare July 8, 2026 11:14
@ikondrat ikondrat enabled auto-merge July 8, 2026 11:16
@ikondrat ikondrat added this pull request to the merge queue Jul 8, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lightly_studio_view/src/lib/hooks/useSelectAll/useSelectAll.ts (1)

84-97: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Keep filter_type out of the raw annotation fetch filter.

Line 92 stamps filter_type into filter, and Line 97 then passes that same object to fetchSampleIdsForAnnotations. The function-level comment says only snapshotFilter should receive the discriminant, so keep the raw fetch filter to annotation predicates only.

Suggested fix
-                const filter =
+                const filter =
                     plotRegion !== null
                         ? {
                               ...get(annotationFilter),
-                              filter_type: GRID_FILTER_TYPE.annotations,
                               embedding_region: plotRegion
                           }
                         : get(annotationFilter);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lightly_studio_view/src/lib/hooks/useSelectAll/useSelectAll.ts` around lines
84 - 97, The raw annotation fetch filter in useSelectAll should not be stamped
with GRID_FILTER_TYPE.annotations; keep filter as only the annotation predicates
and reserve the discriminant for snapshotFilter. Update the logic in
useSelectAll so fetchIds still calls fetchSampleIdsForAnnotations with the
unmodified annotation filter plus embedding_region, while snapshotFilter is the
only object that adds filter_type. Locate the change around
get(annotationFilter), plotRegion, and the returned snapshotFilter/fetchIds
pair.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lightly_studio_view/src/lib/components/Images/syncFilterParams.ts`:
- Around line 18-49: `mergeExternalFilters` is carrying `embedding_region`
across a collection switch without updating the dependent plot-selection count,
so the active filter can survive while `useRegionFilterVisibility` hides its
chip. Update the merge logic in `syncFilterParams.ts` so when
`currentParams.filters.embedding_region` is preserved into `baseParams`, the
corresponding selection count is also seeded or recomputed for the new
collection, keeping `getPlotSelectionCount()` non-zero whenever that region
filter is still active.

---

Outside diff comments:
In `@lightly_studio_view/src/lib/hooks/useSelectAll/useSelectAll.ts`:
- Around line 84-97: The raw annotation fetch filter in useSelectAll should not
be stamped with GRID_FILTER_TYPE.annotations; keep filter as only the annotation
predicates and reserve the discriminant for snapshotFilter. Update the logic in
useSelectAll so fetchIds still calls fetchSampleIdsForAnnotations with the
unmodified annotation filter plus embedding_region, while snapshotFilter is the
only object that adds filter_type. Locate the change around
get(annotationFilter), plotRegion, and the returned snapshotFilter/fetchIds
pair.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 58e0a5f5-9213-418b-a732-c3834ed08e99

📥 Commits

Reviewing files that changed from the base of the PR and between c531a30 and dd81371.

📒 Files selected for processing (29)
  • lightly_studio/src/lightly_studio/api/routes/api/annotation.py
  • lightly_studio/src/lightly_studio/resolvers/annotation_resolver/get_all_with_payload.py
  • lightly_studio/src/lightly_studio/resolvers/annotation_resolver/get_sample_ids.py
  • lightly_studio/src/lightly_studio/resolvers/annotations/annotations_filter.py
  • lightly_studio/src/lightly_studio/resolvers/sample_resolver/sample_filter.py
  • lightly_studio/tests/resolvers/annotations/test_annotations_filters.py
  • lightly_studio/tests/resolvers/sample_resolver/test_sample_filter.py
  • lightly_studio_view/src/lib/components/AnnotationsGrid/AnnotationsGrid.svelte
  • lightly_studio_view/src/lib/components/Images/syncFilterParams.test.ts
  • lightly_studio_view/src/lib/components/Images/syncFilterParams.ts
  • lightly_studio_view/src/lib/components/PlotPanel/PlotPanel.svelte
  • lightly_studio_view/src/lib/components/PlotPanel/PlotPanel.test.ts
  • lightly_studio_view/src/lib/components/PlotPanel/usePlotData/usePlotData.test.ts
  • lightly_studio_view/src/lib/components/PlotPanel/usePlotData/usePlotData.ts
  • lightly_studio_view/src/lib/hooks/useAnnotationsInfinite/createAnnotationsInfiniteOptions.test.ts
  • lightly_studio_view/src/lib/hooks/useAnnotationsInfinite/createAnnotationsInfiniteOptions.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingFilter.test.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingFilterForAnnotations.test.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingFilterForAnnotations.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingFilterForImages.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingPlotSelection.test.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useEmbeddingPlotSelection.ts
  • lightly_studio_view/src/lib/hooks/useEmbeddingFilter/useRegionFilterVisibility.ts
  • lightly_studio_view/src/lib/hooks/useImageFilters/useImageFilters.ts
  • lightly_studio_view/src/lib/hooks/useImagesInfinite/buildRequestBody.ts
  • lightly_studio_view/src/lib/hooks/useImagesInfinite/types.ts
  • lightly_studio_view/src/lib/hooks/useImagesInfinite/useImagesInfinite.test.ts
  • lightly_studio_view/src/lib/hooks/useSelectAll/useSelectAll.ts
  • lightly_studio_view/src/routes/datasets/[dataset_id]/[collection_type]/[collection_id]/+layout.svelte

Comment thread lightly_studio_view/src/lib/components/Images/syncFilterParams.ts
Merged via the queue into main with commit 2926056 Jul 8, 2026
21 checks passed
@ikondrat ikondrat deleted the kondrat/lig-9903-4-images-frontend branch July 8, 2026 11:37
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