Skip to content

Fix duplicate HTMX component parameters#909

Merged
jph00 merged 1 commit into
mainfrom
agent/duplicate-hx-attrs
Jul 22, 2026
Merged

Fix duplicate HTMX component parameters#909
jph00 merged 1 commit into
mainfrom
agent/duplicate-hx-attrs

Conversation

@erikgaas

@erikgaas erikgaas commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Remove duplicate indicator and replace_url entries from hx_attrs.
  • Add a notebook test requiring the exported attribute list to contain unique names.
  • Regenerate components.pyi without duplicate parameters.

Why

tools/mk_pyi.py expands hx_attrs directly into every component signature. Duplicate list entries therefore generate duplicate hx_indicator and hx_replace_url parameters, which makes the stub invalid for mypy.

Runtime component signatures already deduplicate these names, so this change does not alter rendered HTML or supported arguments.

Fixes #908.
Fixes #529.

Checks

  • nbdev-test --path nbs/api/01_components.ipynb
  • Parsed fasthtml/components.pyi with ast.parse
  • Confirmed no generated signature repeats hx_indicator or hx_replace_url
  • Confirmed a fresh interpreter still renders both attributes correctly

@erikgaas
erikgaas marked this pull request as ready for review July 20, 2026 23:50
@erikgaas erikgaas added the bug Something isn't working label Jul 20, 2026
@erikgaas
erikgaas requested a review from jph00 July 20, 2026 23:50
@jph00
jph00 merged commit 24818df into main Jul 22, 2026
2 checks passed
@jph00
jph00 deleted the agent/duplicate-hx-attrs branch July 22, 2026 11:02
@jph00

jph00 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Thanks! BTW @erikgaas I feel like your test is either over-enthusiastic (does this really need a test) or under-enthusiastic (if hx is being tested, why not all of them). Just testing the one thing you changed doesn't seem like the right answer AFAICT! :D

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Duplicate parameter "hx_indicator" in function definition in fasthtml/components.pyi [BUG] Duplicated attributes in components.pyi

2 participants