Skip to content

fix(quote-search): quote length description is incorrect for some languages (@Leonabcd123)#8082

Open
Leonabcd123 wants to merge 24 commits into
monkeytypegame:masterfrom
Leonabcd123:fix/quote-search-length-description
Open

fix(quote-search): quote length description is incorrect for some languages (@Leonabcd123)#8082
Leonabcd123 wants to merge 24 commits into
monkeytypegame:masterfrom
Leonabcd123:fix/quote-search-length-description

Conversation

@Leonabcd123

@Leonabcd123 Leonabcd123 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Fixes #8081.

@monkeytypegeorge monkeytypegeorge added frontend User interface or web stuff packages Changes in local packages labels Jun 10, 2026
@Leonabcd123 Leonabcd123 changed the title fix(quote-search): length description is incorrect for some languages (@Leonabcd123) fix(quote-search): quote length description is incorrect for some languages (@Leonabcd123) Jun 10, 2026
@fehmer

fehmer commented Jun 10, 2026

Copy link
Copy Markdown
Member

Hi @Leonabcd123,

we have the translation from quote.group to a in multiple places. Should we just add it to the Quote type on the frontend as e.g. groupDescriptionand map it once in the controller after reading the json file and check where we can use this instead of the number

Comment thread packages/schemas/src/quotes.ts Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes.

@github-actions github-actions Bot added the waiting for update Pull requests or issues that require changes/comments before continuing label Jun 10, 2026
@fehmer

fehmer commented Jun 10, 2026

Copy link
Copy Markdown
Member

testType += ` ${["short", "medium", "long", "thicc"][randomQuote.group]}`;
should use the new groupDescriptionas well

@fehmer

fehmer commented Jun 10, 2026

Copy link
Copy Markdown
Member

...valueFilter(filters.quoteLength, {
does the reverse mapping, would be great if we use one source for it

@github-actions github-actions Bot removed the waiting for update Pull requests or issues that require changes/comments before continuing label Jun 10, 2026
@fehmer

fehmer commented Jun 10, 2026

Copy link
Copy Markdown
Member

another one

@fehmer

fehmer commented Jun 10, 2026

Copy link
Copy Markdown
Member

and another :)

Comment thread frontend/src/ts/controllers/quotes-controller.ts Outdated
@Leonabcd123 Leonabcd123 marked this pull request as draft June 10, 2026 19:11
fehmer
fehmer previously approved these changes Jun 10, 2026
@suzunn

suzunn commented Jun 11, 2026

Copy link
Copy Markdown

I noticed one runtime regression in the current reverse-map shape. groupToDesc is built with Object.entries(descToGroup).map(...) and then cast to Record<number, QuoteLength>, but the cast does not change the runtime value. That leaves groupToDesc[0] as a tuple like [0, short] instead of the string short, so getLengthDesc() can assign an array to groupDescription and the UI can render 0,short instead of short.

I would change that reverse map to Object.fromEntries(Object.entries(descToGroup).map(([desc, group]) => [group, desc])) and add a small assertion around the controller result for a quote in group 0/1. That should keep the schema source of truth while catching this specific runtime/type-cast mismatch.

@Leonabcd123

Leonabcd123 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

I noticed one runtime regression in the current reverse-map shape. groupToDesc is built with Object.entries(descToGroup).map(...) and then cast to Record<number, QuoteLength>, but the cast does not change the runtime value. That leaves groupToDesc[0] as a tuple like [0, short] instead of the string short, so getLengthDesc() can assign an array to groupDescription and the UI can render 0,short instead of short.

I would change that reverse map to Object.fromEntries(Object.entries(descToGroup).map(([desc, group]) => [group, desc])) and add a small assertion around the controller result for a quote in group 0/1. That should keep the schema source of truth while catching this specific runtime/type-cast mismatch.

Fixed in ed50376.

@Leonabcd123 Leonabcd123 marked this pull request as ready for review June 11, 2026 14:41
@github-actions github-actions Bot added the waiting for review Pull requests that require a review before continuing label Jun 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes.

@github-actions github-actions Bot added waiting for update Pull requests or issues that require changes/comments before continuing and removed waiting for review Pull requests that require a review before continuing labels Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend User interface or web stuff packages Changes in local packages waiting for update Pull requests or issues that require changes/comments before continuing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong length description for quotes in quote search modal for some languages

4 participants