Skip to content

Bugfix: resolve the date range filter label translation in setup - #54

Merged
basmilius merged 2 commits into
mainfrom
fix/filter-label-translate
Sep 22, 2026
Merged

basmilius merged 2 commits into
mainfrom
fix/filter-label-translate

Conversation

@basmilius

Copy link
Copy Markdown
Owner

This PR resolves #52, where FluxFilterDateRange threw Must be called at the top of a setup function as soon as anything re-rendered the filter bar slot.

createLabelForDateRange() called useTranslate() itself. That reaches useI18n(), which needs an active component instance. The helper runs from the getValueLabel() of the date range filter, which the watcher in useFilterValueLabel() calls; that watcher only has an instance on its immediate first run. Every later run comes from the scheduler, where useI18n() throws and the chip's value label is never set.

defineFilter() already hands its factory a translate that FluxFilterBase resolved during its own setup, so the fix is to use it. createLabelForDateRange() now takes that function instead of reaching for one.

The preventCustom parameter is gone. It existed so FluxFormDateRangeInput could spell out a multi-year range instead of labelling it "custom period", which is exactly what the helper now does when it is given no translate function. One parameter instead of two, and no caller has to pass a translate it never uses.

createLabelForDateRange is internal; it is exported from util/index.ts but not from the package root, so the public API is unchanged.

Reported against 4.0.0-beta.6 by @raymondsteffann, who also traced the cause.

createLabelForDateRange() called useTranslate() itself, so it needed an
active component instance. The getValueLabel() of the date range filter
runs from the watcher in useFilterValueLabel(), which fires from the
scheduler on any re-render of the filter bar slot, and useI18n() threw
there.

The definition factory already receives a translate resolved in the setup
of FluxFilterBase, so pass that down instead. Without one the helper
spells the range out, which is what FluxFormDateRangeInput asked for with
preventCustom.

Closes #52
@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 35 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 1981fd39-af07-4666-888d-811f4d39cbb5

📥 Commits

Reviewing files that changed from the base of the PR and between 552e4a0 and e3b9a34.

📒 Files selected for processing (3)
  • packages/components/src/component/filter/FluxFilterDateRange.vue
  • packages/components/src/component/form/FluxFormDateRangeInput.vue
  • packages/components/src/util/createLabelForDateRange.ts

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.

@basmilius basmilius added the Bug label Sep 22, 2026
@basmilius
basmilius merged commit dada6a5 into main Sep 22, 2026
2 checks passed
@basmilius
basmilius deleted the fix/filter-label-translate branch September 22, 2026 09:50
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.

FluxFilterDateRange throws "Must be called at the top of a setup function" from createTranslate

1 participant