Skip to content

Conversation

@YgorSouza
Copy link
Contributor

The name passed to new() defines the initial id, but changing it with name() does not change the id, it has to be changed explicitly with id(). This documentation update attempts to make this caveat more explicit, as it is not apparent from the public API without looking at the source.

  • I have followed the instructions in the PR template

The name passed to new() defines the initial id, but changing it with
name() does not change the id, it has to be changed explicitly with
id(). This documentation update attempts to make this caveat more
explicit, as it is not apparent from the public API without looking at
the source.
@YgorSouza
Copy link
Contributor Author

This tripped me when I was upgrading to v0.32. I thought I could just set the new name argument to an empty string everywhere since I was already using the name() method, and only later realized the legend was partially broken because all the items had the same ID. So I thought I'd add some documentation to explain it more clearly.

Should I add a docstring to every new() method explaining that as well? I'm not sure if that's overkill.

@emilk emilk added the exclude from changelog This change will NOT be included in the changelog label Oct 10, 2025
@emilk
Copy link
Owner

emilk commented Oct 10, 2025

thanks!

@emilk emilk merged commit 82082a6 into emilk:main Oct 10, 2025
10 of 11 checks passed
michalsustr pushed a commit that referenced this pull request Nov 26, 2025
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exclude from changelog This change will NOT be included in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants