The sign-up dialog decides "See alternatives" with its own copy of the rule behind "Pick another slot."
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 25/100
- issue の種類
- リファクタリング
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- next.js, react, typescript
調査の方向性
Read src/app/s/[slug]/capacity-message.ts and src/app/s/[slug]/commit-dialog.tsx, then inspect src/app/s/[slug]/capacity-message.test.ts and the server's SlotAlternative type in src/services/commitments.ts. Add a unit test for empty and missing alternatives, and confirm the shared rule drives both the suggestion and link; the issue also requires the listed lint, format, typecheck, knip, and test commands to pass. Pull request #806 is already open.
索引モデルが issue の本文から書いたものです。
説明
What happens
When a slot fills while someone is signing up, the dialog decides twice whether to point them at other slots:
- The words.
capacityMessageinsrc/app/s/[slug]/capacity-message.tsadds "Pick another slot." only when the error iscapacity_full,remainingandrequestedare numbers,remaining <= 0, anddetails.alternativesis a non-empty array. - The link.
CommitDialoginsrc/app/s/[slug]/commit-dialog.tsxshows its "See alternatives" link with its own inline check:error.details?.alternatives?.length && error.details.remaining === 0. That check doesn't look at the error code orrequested, and uses=== 0where the other uses<= 0.
The dialog's local ApiError type also describes the alternatives wrongly, as { id: string; title: string }[]. The server sends SlotAlternative, which is { id, ref, slotAt } (src/services/commitments.ts). Nothing reads title, so nothing renders wrong, but the type misleads the next person who does.
Today the two checks agree on every payload the server can send, because capacityFull always sends remaining and requested as numbers and clamps remaining at 0. They only disagree on payloads the server never sends. So this is drift waiting to happen, and nobody sees a difference now.
Fix, in outline
- In
capacity-message.ts, export one small function (for exampleoffersAlternatives(error)) that holds the rule:capacity_full, a finiteremaining <= 0, and a non-emptyalternativesarray. Use it incapacityMessage's join branch. - In
commit-dialog.tsx, show "See alternatives" from that same function instead of the inline condition. - Fix the
alternativestype in the dialog'sApiErrorto matchSlotAlternative(orunknown[], since only its length is used). - Add a unit test in
capacity-message.test.tsfor the new function, including an emptyalternativesarray and a payload with noalternativeskey (the change-quantity path sends none).
Watch for
- No visible change. The hint and the link must still appear together, only when the slot is full and the server found at least one open slot. The wording and the link target (
/s/<slug>) stay as they are. - Server side is done. #782 / #787 fixed which slots the server offers. Leave
src/services/commitments.tsalone. participantErrorCopyinparticipant-error.tscallscapacityMessage; it shouldn't need to change.
Done when
- The "See alternatives" link and the "Pick another slot." suggestion are decided by one function.
- The dialog's
alternativestype matches what the server sends. - A unit test pins the function.
pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm testpass.
Found by the pipeline's refactor scout in the participant pages (src/app/s/[slug]), at d1e9e14. Checked by an independent verify agent, which ran a scratch vitest of both conditions over every payload shape the server sends (19 of 19 agree) and over synthetic ones where they differ, and grepped every use of alternatives. https://claude.ai/code/session_016YZ9SSPmh7nC1k9RsPc5NE
- 主要言語
- TypeScript
- スター
- 19
- フォーク
- 4
- 平均マージ
- 19時間 27分
- マージ済み PR(30日)
- 199
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
richshaw/OpenSignup のほかの issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
richshaw/OpenSignup#794 ·
メンテナーはふだん 1 日以内に返信
-
enhancement pipeline:proposed pipeline:ux
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
richshaw/OpenSignup#654 ·
メンテナーはふだん 1 日以内に返信
-
Slot times are shown with their own copy of the HH:MM rule that saving them checks対応中かも @novakzx が今日担当しました。 オープンenhancement good first issue pipeline:ready
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
richshaw/OpenSignup#805 ·
メンテナーはふだん 1 日以内に返信
-
A failed database query logs its parameters, so OAuth tokens and participant details can end up in the logs対応中かも @richshaw が 1 日前に担当しました。 オープンbug pipeline:building
richshaw/OpenSignup#800 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Two breadcrumb pages belong to URLs that always redirect, so they never show対応中かも @richshaw が 2 日前に担当しました。 オープンenhancement good first issue pipeline:stuck
richshaw/OpenSignup#793 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
richshaw/OpenSignup の issue をすべて見る
似ている issue
-
The sample email preview's ResizeObserver is never disconnected and keeps raising errors after leaving Settings対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
area:ui bug effort:S priority:P2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Typo in WSL project description on Projects page対応中かも @akhil9tiet が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
microsoft/opensource.microsoft.com#1066 · コメント 1 件 ·
-
ArcGIS Maps SDK for JavaScript c-carousel calcite-design-tokens enhancement impact - p3 - not time sensitive needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Esri/calcite-design-system#15565 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
linkwarden/linkwarden#1891 ·
メンテナーはふだん 1 日以内に返信