Skip to content

Fix adding select empty values for docs component#1796

Merged
carlosabadia merged 10 commits intomainfrom
carlos/fix-link-select
Apr 1, 2026
Merged

Fix adding select empty values for docs component#1796
carlosabadia merged 10 commits intomainfrom
carlos/fix-link-select

Conversation

@carlosabadia
Copy link
Copy Markdown
Collaborator

@carlosabadia carlosabadia commented Mar 30, 2026

Closes #1795

@carlosabadia carlosabadia changed the title Fxi select empty values Fix select empty values for docs component Mar 30, 2026
@carlosabadia carlosabadia changed the title Fix select empty values for docs component Fix adding select empty values for docs component Mar 30, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 30, 2026

Greptile Summary

This PR fixes empty-value handling in the documentation component's render_select function by filtering out empty strings ("") from Literal type arguments before selecting a default value and rendering select options.

Changes made:

  • Filters out empty-string literal values when building the literal_values list for Union[Literal, Breakpoints] types
  • Uses the first non-empty argument as the initial option for Literal types, with a fallback to the original first arg if all values are empty
  • Excludes empty-string items from the rx.select dropdown item list

Issue found:

  • The color_scheme popover grid (line ~190) still iterates over list(map(str, type_.__args__)) without filtering empty strings — the same fix applied to the rx.select branch was not applied here, so an empty swatch could still be rendered in the color picker grid

Confidence Score: 4/5

Safe to merge after fixing the missed empty-string filter in the color_scheme popover grid

The fix is correct and targeted, but the color_scheme popover was not updated with the same empty-string filter applied elsewhere, leaving a real rendering defect in that branch

pcweb/pages/docs/component.py — color_scheme popover color grid loop at line 190

Important Files Changed

Filename Overview
pcweb/pages/docs/component.py Filters empty strings from Literal type args in select/option rendering, but misses the same filter in the color_scheme popover grid loop

Comments Outside Diff (1)

  1. pcweb/pages/docs/component.py, line 190 (link)

    P1 Missing empty-string filter in color_scheme popover

    The same empty-string filtering applied to the rx.select dropdown at line 213 was not applied to the color_scheme popover grid. An empty string in type_.__args__ would still be rendered as a color swatch here, producing a broken/invisible tile in the color picker.

Reviews (1): Last reviewed commit: "Fxi select empty values" | Re-trigger Greptile

@Alek99 Alek99 self-requested a review April 1, 2026 00:14
@carlosabadia carlosabadia merged commit 2d9739e into main Apr 1, 2026
10 checks passed
@carlosabadia carlosabadia deleted the carlos/fix-link-select branch April 1, 2026 09:22
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.

Link Bug

2 participants