Skip to content

feat: add default showed categories#384

Open
raven-wing wants to merge 1 commit into
Problematy:nextfrom
raven-wing:default_visible
Open

feat: add default showed categories#384
raven-wing wants to merge 1 commit 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

    • Categories can now load with preselected default options, and those selections appear checked automatically in the filter form.
    • Category data responses now include default checked values alongside category options.
  • Bug Fixes

    • Filter checkboxes now behave as controlled inputs, improving consistency between the UI and saved selections.
    • Categories without defaults continue to render with no preselected options.

@coderabbitai

coderabbitai Bot commented Jul 9, 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1be7df97-87ed-4d6a-b9d8-50099413874e

📥 Commits

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

📒 Files selected for processing (7)
  • frontend/src/components/FiltersForm/FiltersForm.jsx
  • frontend/src/services/http/httpService.js
  • frontend/tests/FiltersForm.test.jsx
  • goodmap/core_api.py
  • goodmap/db.py
  • tests/unit_tests/test_core_api.py
  • tests/unit_tests/test_db.py

📝 Walkthrough

Walkthrough

Backend database and API layers now return a categories_default_checked / default_checked field alongside category data. The frontend HTTP service parses this into a defaultChecked map, and FiltersForm uses it to initialize context selection and render controlled checkboxes. Tests updated accordingly across both layers.

Changes

Default-checked categories support

Layer / File(s) Summary
Database layer field addition
goodmap/db.py, tests/unit_tests/test_db.py
All *_get_category_data backend functions (json, json file, google json, mongodb) now include categories_default_checked in filtered/unfiltered responses and mongodb fallback; tests updated with fixture and expected-output changes.
API endpoint exposure
goodmap/core_api.py, tests/unit_tests/test_core_api.py
/api/categories-full adds a default_checked field per category entry sourced from categories_default_checked, defaulting to []; new tests cover configured and unconfigured defaults.
HTTP service parsing
frontend/src/services/http/httpService.js
getCategoriesData now computes and returns { categories, defaultChecked } instead of only the categories array.
Controlled filter checkboxes
frontend/src/components/FiltersForm/FiltersForm.jsx, frontend/tests/FiltersForm.test.jsx
FiltersForm reads selectedFilters from context, initializes selection from defaultChecked, and renders checkboxes with a checked prop; tests verify mocked response shape and checkbox checked state.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

  • Problematy/goodmap#322: Both PRs modify the categories-full response shape, with this PR extending it to include default_checked consumed by the frontend for checkbox state.
  • Problematy/goodmap#323: Both PRs enrich the same /api/categories-full category entries, this one adding default_checked alongside prior categories_help/options_help additions.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% 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 concise and clearly reflects the main change: adding default-visible categories.
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.

@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

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