Fix code smells
Build App / Build (push) Failing after 2s

This commit is contained in:
2026-08-07 13:22:53 +02:00
parent 937b8554dd
commit f934e69c90
45 changed files with 3400 additions and 395 deletions
@@ -63,3 +63,23 @@ export function toDto(draft: Draft): GameDTO {
export function nextOrder(games: GameDTO[]): number {
return games.reduce((max, game) => Math.max(max, game.order ?? 0), 0) + 1;
}
/**
* Whether the editor holds unsaved changes.
*
* Field by field rather than by comparing `JSON.stringify` output, which is
* key-order dependent: it would report a clean draft as dirty the moment
* `blankDraft` and `toDraft` listed their keys in a different order.
*/
export function isDirty(a: Draft, b: Draft): boolean {
return (
a.id !== b.id ||
a.name !== b.name ||
a.longName !== b.longName ||
a.order !== b.order ||
a.imgUrl !== b.imgUrl ||
a.wordPressTag !== b.wordPressTag ||
a.wordPressTagOs !== b.wordPressTagOs ||
a.smashId !== b.smashId
);
}