LF-5169: Previously Applied Filters Persist on Animals Page After Switching Farms#4080
Open
litefarm-pr-bot wants to merge 1 commit intointegrationfrom
Conversation
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
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.
Description
When a user applies filters on the Animals page and then switches to a different farm, the filter state was stored in
tempStateReducer.filterReducer(Redux). The root reducer only clearsfarmStateReduceron farm switch, andclearOldFarmStateSaga— which handles cleanup during the farm-switch saga flow — did not include a reset for the Animals filter. Because the filter state lives outsidefarmStateReducer, it survived the farm transition intact.The fix adds
resetAnimalsFilter()toclearOldFarmStateSagaincontainers/saga.js, alongside the existingresetTasks()andresetDateRange()calls. This ensures Animal filters are cleared at the same point in the farm-switch flow as other domain-specific state.Any new domain-specific filter state stored in
tempStateReducershould similarly be reset inclearOldFarmStateSagarather than relying on the root reducer'sSWITCH_FARMShandling, which only coversfarmStateReducer.Jira link: https://lite-farm.atlassian.net/browse/LF-5169
Type of change
How Has This Been Tested?
Logic change reviewed in source code. No local frontend running; visual review not performed. The fix is a single
yield put(resetAnimalsFilter())call in an existing saga, consistent with howresetTasks()is handled in the same function.Checklist:
pnpm i18nto help with this)