Skip to content

fix: don't write "mixed" tag placeholder when bulk editing transactions - #201

Open
GlebYavorski wants to merge 1 commit into
ardov:masterfrom
GlebYavorski:fix/bulk-edit-mixed-tag
Open

fix: don't write "mixed" tag placeholder when bulk editing transactions#201
GlebYavorski wants to merge 1 commit into
ardov:masterfrom
GlebYavorski:fix/bulk-edit-mixed-tag

Conversation

@GlebYavorski

Copy link
Copy Markdown

Fixes #147

Проблема

При массовом редактировании операций с разными категориями модалка подставляет служебный тег mixed («Разные категории»), который при сохранении должен раскрываться в собственные категории каждой операции. Но если у операции категории нет вообще, prevTags === null, и проверка

if (id === 'mixed' && prevTags) prevTags.forEach(addId)
else addId(id)

уходит в else, записывая строку 'mixed' в операцию как настоящий id категории.

После этого usePopulatedTags()['mixed'] возвращает undefined, и рендер списка операций падает в Symbol (Transaction.Components.tsx) на tag.symbol — приложение целиком уходит в error boundary («Что-то навернулось… dt is undefined»).

Фикс

'mixed' раскрывается в собственные теги операции независимо от того, есть они или нет: if (id === 'mixed') prevTags?.forEach(addId).

Тесты

Добавлен src/5-entities/transaction/thunks.test.ts — два кейса на bulkEditTransactions: обычное добавление категории к операциям с разными категориями и кейс из issue (одна операция без категории). Второй тест падает без фикса (expected [ 'mixed', 'tag3' ] to deeply equal [ 'tag3' ]) и проходит с ним.

npx tsc --noEmit чистый. npx vitest run — 17 тестов проходят; TagSelect2.test.tsx падает на этапе загрузки (мок i18next без default-экспорта) — это воспроизводится и на master без этих изменений, к PR не относится.

🤖 Generated with Claude Code

When bulk editing transactions with different categories, the modal puts
a `mixed` placeholder in the tag list, and `modifyTags` is supposed to
expand it into each transaction's own tags. For a transaction without any
category `prevTags` is `null`, so the `id === 'mixed' && prevTags` check
fell through to the `else` branch and stored the literal `mixed` string as
a tag id.

After that `usePopulatedTags()['mixed']` is `undefined` and rendering the
transaction list crashes in `Symbol` (`tag.symbol` of undefined), taking
the whole app down.

Fixes ardov#147

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

@GlebYavorski is attempting to deploy a commit to the Alexey Ardov's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant