Skip to content

Conversation

gmaclennan
Copy link
Member

@gmaclennan gmaclennan commented Sep 17, 2025

This addresses the uncaught errors and performance issues listed in #837.

This also switches to a mutating deNullify() function. Previously reading docs was cloning twice: once to remove null fields, and then to translate. Translating is also mutating now.

This also addresses a perf issue when adding derived fields and translations: previously we were awaiting 3-4 promises in serial (previously there were two translation lookups for many docs). This switches those promises to parallel, and removes one.

The internal types for these functions are too difficult for TS to follow, because of the generics for the class.

NB: Also fixes the return type of getByVersionId(), which was not including the derived fields createdBy and createdAt

We currently only support translations for presets and fields. Attempting to translate other docs is a performance overhead. Makes `getTranslations` optional, and also fixes a possible uncaught error from the translation datatype getTranslations fn
We were cloning docs for both translation and removing null fields, and running several promises in series.
It's faster to get translations including all region codes and filter them, rather than get translations twice, once with a region code and once without.
@gmaclennan gmaclennan self-assigned this Sep 17, 2025
@gmaclennan gmaclennan merged commit 10049ff into main Sep 17, 2025
9 checks passed
@gmaclennan gmaclennan deleted the fix/translation-fixes branch September 17, 2025 15:57
@gmaclennan gmaclennan mentioned this pull request Sep 17, 2025
6 tasks
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