Skip to content

fix: fall back to example addresses in summary preview - #303

Merged
wa0x6e merged 1 commit into
snapshot-labs:mainfrom
chai3-bot:fix/preview-summary-addresses
Aug 15, 2026
Merged

fix: fall back to example addresses in summary preview#303
wa0x6e merged 1 commit into
snapshot-labs:mainfrom
chai3-bot:fix/preview-summary-addresses

Conversation

@chai3-bot

Copy link
Copy Markdown
Contributor

Summary

  • fix the summary preview fallback when no custom proposal id is provided
  • keep this behavioral change separate from the ESLint/Prettier upgrade PRs

The previous [customParams.id] || constants.example.addresses expression never reached the fallback because an array is always truthy.

Checks

  • yarn typecheck
  • yarn lint

@ChaituVR ChaituVR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utAck

@tony8713 tony8713 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Confirmed the bug: [customParams.id] || constants.example.addresses always short-circuits to [customParams.id] because a non-empty array literal is always truthy, so with no ?id= query param the summary preview rendered with [undefined] instead of the example address. The ternary fixes it correctly and the empty-string case (?id=) now also falls back to the examples, which is the right behavior.

Verified against src/preview/index.ts (id: req.query.id) — this only affects the auth-gated dev preview endpoint, no runtime notification path touched. Nicely scoped out of the eslint/prettier PRs.

Not blocking, just noting: a repeated ?id=a&id=b query param would make req.query.id an array and produce a nested [['a','b']], but that's a pre-existing degenerate input to a dev-only tool and out of scope here.

@wa0x6e
wa0x6e merged commit 18c9dfc into snapshot-labs:main Aug 15, 2026
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.

4 participants