Skip to content

fix(client_v2): filter interval reset on mount and untranslated modal labels - #8551

Closed
hoang-rio wants to merge 3 commits into
AdguardTeam:masterfrom
abpvn:fix/client_v2-filter-config
Closed

fix(client_v2): filter interval reset on mount and untranslated modal labels#8551
hoang-rio wants to merge 3 commits into
AdguardTeam:masterfrom
abpvn:fix/client_v2-filter-config

Conversation

@hoang-rio

Copy link
Copy Markdown
Contributor

Closes #8550.

Purpose

Fixes two client_v2 bugs:

  1. Filter update interval reset to 24hSettings/FiltersConfig ran an
    unconditional createEffect on mount that posted setFiltersConfig with the
    default interval (24h) before getFilteringStatus() had resolved, silently
    overwriting a saved interval such as 1 hour on the backend. It now posts only
    when the "Enabled" toggle actually changes.

  2. Modal radio labels stuck in EnglishFilterUpdateModal built its radio
    options once at module load, freezing labels via intl.getMessage() in the
    initial (English) locale. After switching the UI to Vietnamese, title and
    buttons translated but the interval radios stayed English ("Disabled" instead
    of "Vô hiệu"). Options are now rebuilt in a memo so labels follow the current
    locale.

Note: #2 is a code bug (labels not re-resolved on language switch), not a
localization content issue — the Vietnamese strings were already correct, so it
does not belong on CrowdIn.

How does the change achieve it

  • FiltersConfig.tsx — the config POST is gated behind
    createEffect(on(enabled, …, { defer: true })), so it only fires when the
    user toggles the switch instead of on every mount.
  • FilterUpdateModal.tsxRADIO_OPTIONS moved from a module-level constant
    into a createMemo inside the component, making labels reactive to
    intl.changeLanguage().

Tests

  • client_v2/src/__tests__/components/Settings/FiltersConfig.test.tsx — new:
    no POST on mount, no overwrite while status is loading, toggle still posts.
  • client_v2/src/__tests__/components/FilterLists/filter-update-modal.test.tsx
    new: asserts "Vô hiệu" after intl.changeLanguage('vi').
  • npm run check passes (645 tests, lint, typecheck).

…l on mount

The mount effect in FiltersConfig posted setFiltersConfig unconditionally,
which could overwrite the backend interval (e.g. 1 hour) with the default
24 hours before getFilteringStatus resolved. Only post when the enabled
toggle actually changes.
The radio options were built once at module load, freezing labels in
English after a language switch. Rebuild them in a memo so intl resolves
per current locale.
@hoang-rio
hoang-rio force-pushed the fix/client_v2-filter-config branch from c2d2ecf to 90aa237 Compare August 13, 2026 05:55
@hoang-rio hoang-rio closed this Aug 28, 2026
@hoang-rio
hoang-rio deleted the fix/client_v2-filter-config branch August 28, 2026 14:23
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.

client_v2: filter update interval resets to 24h; modal labels don't follow language switch

1 participant