Skip to content
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

Merged
merged 2 commits into from
Jan 11, 2024

Conversation

kcaze
Copy link
Collaborator

@kcaze kcaze commented Jan 11, 2024

Addresses #672.

Copy link
Contributor

@rgossiaux rgossiaux left a 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

Comment on lines 14 to 22
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());

Copy link
Contributor

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)

export const selectPuzzleTags = createSelector(
[puzzlesSelectors.selectAll],
(puzzles) => {
// Use a map to dedupe puzzle tags by name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@kcaze kcaze merged commit 3a3f314 into main Jan 11, 2024
2 checks passed
@kcaze kcaze deleted the kcaze/recompute_tags branch January 11, 2024 03:37
akirabaruah pushed a commit that referenced this pull request Jan 12, 2024
* Add puzzle tag selector and merge them.

* Dedupe by id.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants