-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add puzzle tag selector and merge puzzle + hunt tags. #755
Conversation
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.
sweet, thank you! left a nit
hunts/src/EditPuzzleTagsModal.js
Outdated
const huntTags = useSelector(selectHuntTags); | ||
const puzzleTags = useSelector(selectPuzzleTags); | ||
// Use a map to concat huntTags and puzzleTags and then dedupe. | ||
const tagMap = new Map(); | ||
for (const tag of huntTags.concat(puzzleTags)) { | ||
tagMap.set(tag.name, tag); | ||
} | ||
const allTags = Array.from(tagMap.values()); | ||
|
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 think you can dedupe by id instead of name (though since atm tags can't be renamed it's all the same, but I think id is still better)
hunts/src/puzzlesSlice.js
Outdated
export const selectPuzzleTags = createSelector( | ||
[puzzlesSelectors.selectAll], | ||
(puzzles) => { | ||
// Use a map to dedupe puzzle tags by name. |
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.
ditto
* Add puzzle tag selector and merge them. * Dedupe by id.
Addresses #672.