Skip to content

Route default to /all-books and refactor book filters to server-driven signals#1

Merged
dinosmm merged 1 commit into
dmsfrom
codex/recreate-sidebar-filter-behaviors
Apr 24, 2026
Merged

Route default to /all-books and refactor book filters to server-driven signals#1
dinosmm merged 1 commit into
dmsfrom
codex/recreate-sidebar-filter-behaviors

Conversation

@dinosmm

@dinosmm dinosmm commented Apr 24, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Move the post-login and root redirect target from /dashboard to the new /all-books landing route.
  • Replace client-side aggregation of filter values with server-provided filter option signals to simplify logic and improve performance.
  • Ensure filter lists are consistently sorted and panels auto-expand when the filter pane is shown.

Description

  • Replaced navigations to ['/dashboard'] with ['/all-books'] in LoginComponent, OidcCallbackComponent, and setup redirect guards and updated corresponding unit tests.
  • Reworked BookFilterService to stop aggregating books locally and instead build cached Signal<Filter[]> values from AppBooksApiService endpoints, adding helper functions serverOptionsToFilters, countedToFilters, and rangedFilters to normalize server responses.
  • Updated BookFilterComponent to sort visible filter types by label, expose getSortedFilters() for stable client-side display, auto-expand panels when the filter view is shown via an effect, and use getSortedFilters() in the template and virtual scroll sizing.
  • Updated templates and tests to consume the new server-driven filter signals and the new routing target.

Testing

  • Ran frontend unit tests with the test runner (vitest) covering updated specs including oidc-callback.component.spec.ts, login.component.spec.ts, setup-guards.spec.ts, and setup-redirect.guard.spec.ts, and all relevant tests passed.
  • Verified template/type changes compile via the standard frontend test/build step and no automated tests failed.

Codex Task

@dinosmm dinosmm merged commit 0ba268f into dms Apr 24, 2026

@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: 6b5ac984f0

ℹ️ 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".

Comment on lines +109 to +112
signals['amazonRating'] = computed(() => this.rangedFilters(this.appBooksApi.amazonRatingOptions(), ratingRanges));
signals['goodreadsRating'] = computed(() => this.rangedFilters(this.appBooksApi.goodreadsRatingOptions(), ratingRanges));
signals['hardcoverRating'] = computed(() => this.rangedFilters(this.appBooksApi.hardcoverRatingOptions(), ratingRanges));
signals['pageCount'] = computed(() => this.rangedFilters(this.appBooksApi.pageCountOptions(), pageCountRanges));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add missing rating filter signals for all supported filter types

buildFilterSignals() skips lubimyczytacRating, ranobedbRating, and audibleRating even though these filter types are part of VisibleFilterType defaults and AppBooksApiService exposes option signals for them. Because BookFilterComponent derives filterTypes from Object.keys(filterSignals), those three filters disappear from the sidebar entirely and any saved visibility settings for them become unusable.

Useful? React with 👍 / 👎.

Comment on lines +76 to +78
private readonly autoExpandVisiblePanels = effect(() => {
if (!this.showFilter()) return;
this.expandedPanels.set(this.getAutoExpandedPanels());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Limit auto-expand effect to filter pane open transitions

This effect reruns whenever dependencies inside getAutoExpandedPanels() change (including activeFilters and server option signals), so while the filter pane is open it repeatedly resets expandedPanels and overrides user-collapsed accordion state. In practice, selecting a filter or option refresh can re-expand panels unexpectedly; this should only run when showFilter transitions from hidden to visible.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant