-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disentangle filter types + library counts + selections #778
base: master
Are you sure you want to change the base?
Disentangle filter types + library counts + selections #778
Conversation
mapFn: (m: PhotoDTO) => [m.metadata.positionData?.country], | ||
renderType: FilterRenderType.enum, | ||
}, | ||
} as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pulled this out of the service class itself so that I can derive type
declarations from it.
} | ||
return filterValueCounts; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This filters in a single pass over c.media
. I don't love encoding some of the filter logic here though - e.g. "if there are no keywords, leave it in." I'd love to factor this out into the individual filters themselves.
f6c90a3
to
4cf17df
Compare
This is work as intended. The filters bar is actually a copy from lightroom and tries to mimic the same behavior. |
I find it hard to review this PR. Can you let me know if this change does any:
Do I understand correctly this is only a refactor and should not have any changes? Can you help the review with the following:
If there is a behavioral and or UI change. Please elaborate on them also include a screenshot that clearly shows the difference. Sorry but after work I find it hard to gather the brain capacity to review complex PRs. |
Yes, that's correct with the exception of the left-to-right filter behavior, which I didn't understand was intended. I'll revert that change, and there shouldn't be any other behavior changes - it's purely intended to split apart filter behavior, selection data, and library state data.
Happy to put up a test PR - do you have a preference between an E2E test vs. a unit test around the filter service?
No worries - thanks for maintaining the project! |
64a4fc7
to
1da5309
Compare
Thank you. I fine with any of them. Edit: unit tests are usually more stable. E2E depends on a lot of external pieces (like the sample gallery). |
I also made some change in this space. See latest commit. I expect it to be an easy merge |
I will reject this PR in the following days due to lack of activity. |
Based on #780
Why
Currently, the active filter state intermingles:
mapFn
,name
, etc.Because of this, even starting on #776 isn't really feasible.
What
This PR separates out:
FilterService.filters
+FilterService.filtersMap
FilterService.filterState.filterValueCounts
FilterServie.filterState.selectedFilters
What else
This also fixes an odd issue where the leftward filters impact the counts on filters to their right, but not vice-verse. Now filters all report all values in the date-filtered photo set. If this is intended, I can update it to be consistent instead of left-to-right.This was intended - I just misunderstood the desired behavior.Additionally, I've addressed a number of inconsistencies and type issues - removing casts and making
mapFn
always returnstring[] | undefined
.