Tax category page follow-up cleanups

オープン
#5,305 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
react, typescript
領域
frontend, testing

調査の方向性

The issue lists four independent cleanups under packages/client, with target files and a test file named for the BusinessScreen change. Start with one cleanup, read its listed call sites, and run the corresponding tests; for the screen change, update screens/businesses/__tests__/business-screen.test.tsx. Done means the selected cleanup is covered by passing tests, with behavior unchanged.

索引モデルが issue の本文から書いたものです。

説明

Cleanups noticed during the tax category page work (docs/tax-category-page/). None change behaviour.

  1. Remove BusinessScreen's unreachable fallback. packages/client/src/components/screens/businesses/business.tsx keeps a paused urql useQuery plus a no-loader <Navigate> branch. The /businesses/:businessId route always runs businessLoader (it either returns data or throws), so that path never runs in the app. Drop it, as was done for TaxCategoryScreen, and simplify the refresh to useRevalidator. Update screens/businesses/__tests__/business-screen.test.tsx.

  2. Shared membership-role lookup. Several call sites look up the user's role in a business with memberships.find(m => m.businessId === id)?.role, each with its own rules about who may edit:

    • components/business/admin/securities-settings-section.tsx
    • components/business/admin/depreciation-settings-section.tsx
    • components/manual-automations/manual-automations-access.ts
    • components/tax-category/details-section.tsx

    Extract a pure getMembershipRole(userContext, businessId) helper. Keep each site's role set and scope rules where they are; only the lookup is shared.

  3. Shared renderWithRouter test helper. About 30 client test files repeat the same createRoot + act + MemoryRouter harness, for example the cell tests under charges/cells/__tests__, ledger-table/__tests__, transactions-table/cells/__tests__, documents-table/cells/__tests__, business-ledger/cells/__tests__ and charge-matches/cells/__tests__. A shared helper would shorten them; migrate a few as part of adding it.

  4. NamedFinancialEntityRef type alias. FinancialEntityRef & { name: string } (from packages/client/src/router/routes.ts) is repeated in:

    • business-ledger/cells/business-name-cell.tsx
    • business-ledger/cells/counter-account-cell.tsx
    • charge-matches/cells/business.tsx
    • charge-matches/index.tsx
    • charges/cells/counterparty.tsx
    • ledger-table/counterparty-cell.tsx
    • common/financial-entity-link.tsx

    Add one alias next to FinancialEntityRef.

These can land as separate small PRs.

主要言語
TypeScript
スター
30
フォーク
10
平均マージ
2日 12時間
マージ済み PR(30日)
276

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Urigo/accounter-fullstack のほかの issue

Urigo/accounter-fullstack の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。