Skip to content

feat: add default showed categories#384

Open
raven-wing wants to merge 8 commits into
Problematy:nextfrom
raven-wing:default_visible
Open

feat: add default showed categories#384
raven-wing wants to merge 8 commits into
Problematy:nextfrom
raven-wing:default_visible

Conversation

@raven-wing

@raven-wing raven-wing commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Category filters now support configurable default selections, pre-checking the appropriate checkboxes on initial load.
    • The backend and UI expose default_checked data to drive the initial filter state.
  • Bug Fixes
    • Filter checkbox state is now fully controlled to match current selections.
    • Map/location fetching now waits for filter initialization so results reflect default-checked options.
  • Documentation
    • Documented categories_default_checked, including related help/options configuration and examples.
  • Tests
    • Updated and expanded unit, integration, and end-to-end tests/fixtures to verify default-checked, missing-default, and mismatch-filter behaviors, plus added helpers to clear default filters for specific scenarios.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a44c1642-fb37-4da7-99d0-9c165f13011d

📥 Commits

Reviewing files that changed from the base of the PR and between f032d04 and f0fe35e.

📒 Files selected for processing (8)
  • e2e-tests/tests/basic/test_accessibility_table.py
  • e2e-tests/tests/basic/test_language.py
  • e2e-tests/tests/basic/test_map.py
  • e2e-tests/tests/basic/test_mobile_box.py
  • e2e-tests/tests/basic/test_popup.py
  • e2e-tests/tests/basic/test_share.py
  • e2e-tests/tests/conftest.py
  • frontend/src/components/FiltersForm/FiltersForm.jsx

📝 Walkthrough

Walkthrough

Backend database and API layers now return category default selections. The frontend parses these into defaultChecked, initializes controlled filter state, and delays map fetching until initialization completes. Unit, component, end-to-end, fixture, and documentation updates cover the behavior.

Changes

Default-checked categories support

Layer / File(s) Summary
Database responses expose category defaults
goodmap/db.py, tests/unit_tests/test_db.py
Supported category-data backends include categories_default_checked, including MongoDB fallback behavior; fixtures and expected outputs reflect the new field.
API exposes per-category defaults
goodmap/core_api.py, tests/unit_tests/test_core_api.py
/api/categories-full adds default_checked to each category entry and removes values not present in the category options.
Frontend initializes controlled filter selections
frontend/src/services/http/httpService.js, frontend/src/components/Categories/CategoriesContext.jsx, frontend/src/components/FiltersForm/FiltersForm.jsx, frontend/tests/FiltersForm.test.jsx
The HTTP service returns { categories, defaultChecked }; FiltersForm initializes context state, renders controlled checkbox values, and provides retryable loading-error UI.
Map fetching waits for initialization
frontend/src/components/Map/components/Markers.jsx, frontend/tests/Map/MapComponent.test.jsx
Markers waits for category initialization before fetching locations, and tests verify the initial request is filtered and not duplicated.
Configuration and end-to-end validation
README.md, docs/quickstart.rst, e2e-tests/..., examples/e2e_test_data.json
Documentation and example fixtures describe categories_default_checked; end-to-end tests verify configured defaults and clear them where unfiltered seeded data is required.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Backend
  participant CategoriesAPI
  participant HttpService
  participant FiltersForm
  participant CategoriesProvider
  participant Markers
  participant LocationsAPI
  Backend->>CategoriesAPI: Provide categories_default_checked
  CategoriesAPI->>HttpService: Return default_checked per category
  HttpService->>FiltersForm: Return categories and defaultChecked
  FiltersForm->>CategoriesProvider: Initialize selected filters
  Markers->>LocationsAPI: Fetch filtered locations after initialization
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is clearly related to the main change: adding default-visible/default-checked categories to the filter flow.
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 unit tests (beta)
  • Create PR with unit tests

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.

@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

🤖 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 `@README.md`:
- Around line 94-96: Specify the JSON language identifier on the fenced code
block containing the accessible_by example by changing its opening fence to
json. Preserve the example content and closing fence.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 69c26e0d-ea17-4404-91b2-2b5c6632b77e

📥 Commits

Reviewing files that changed from the base of the PR and between 349b5b9 and c521ece.

📒 Files selected for processing (5)
  • README.md
  • docs/quickstart.rst
  • e2e-tests/e2e_test_data_initial.json
  • e2e-tests/tests/basic/test_left_panel.py
  • examples/e2e_test_data.json

Comment thread README.md Outdated

@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

🤖 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 `@frontend/src/components/FiltersForm/FiltersForm.jsx`:
- Around line 187-195: Update the category-loading flow in FiltersForm so a
rejected getCategoriesData request does not set initialization complete. Catch
the request error, establish the component’s explicit fallback or retry state,
and only call setIsInitialized(true) after categories data has been loaded
successfully; keep loader cleanup in the failure path without allowing location
fetching with uninitialized filters.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3c405ee5-3f6a-41c6-b326-7dccabb836ca

📥 Commits

Reviewing files that changed from the base of the PR and between c9f082a and f032d04.

📒 Files selected for processing (8)
  • frontend/src/components/Categories/CategoriesContext.jsx
  • frontend/src/components/FiltersForm/FiltersForm.jsx
  • frontend/src/components/Map/components/Markers.jsx
  • frontend/src/services/http/httpService.js
  • frontend/tests/FiltersForm.test.jsx
  • frontend/tests/Map/MapComponent.test.jsx
  • goodmap/core_api.py
  • tests/unit_tests/test_core_api.py
🚧 Files skipped from review as they are similar to previous changes (4)
  • frontend/src/services/http/httpService.js
  • frontend/tests/FiltersForm.test.jsx
  • tests/unit_tests/test_core_api.py
  • goodmap/core_api.py

Comment thread frontend/src/components/FiltersForm/FiltersForm.jsx Outdated
@sonarqubecloud

Copy link
Copy Markdown

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