Repository navigation
Bugfix: resolve the date range filter label translation in setup - #54
Merged
Merged
Conversation
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
|
Warning Review limit reachedNext included review available in 35 minutes. View limit detailsLimit 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. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR resolves #52, where
FluxFilterDateRangethrewMust be called at the top of a setup functionas soon as anything re-rendered the filter bar slot.createLabelForDateRange()calleduseTranslate()itself. That reachesuseI18n(), which needs an active component instance. The helper runs from thegetValueLabel()of the date range filter, which the watcher inuseFilterValueLabel()calls; that watcher only has an instance on itsimmediatefirst run. Every later run comes from the scheduler, whereuseI18n()throws and the chip's value label is never set.defineFilter()already hands its factory atranslatethatFluxFilterBaseresolved during its own setup, so the fix is to use it.createLabelForDateRange()now takes that function instead of reaching for one.The
preventCustomparameter is gone. It existed soFluxFormDateRangeInputcould 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.createLabelForDateRangeis internal; it is exported fromutil/index.tsbut 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.