dashy
dashy copied to clipboard
[BUG] Duplicate ItemId's being generated, causing references to be made that should not be made.
Environment
Self-Hosted (Docker)
System
Chrome, 108.0.5359.125
Version
2.1.1
Describe the problem
I have some sections for managing some domains that I own. Their title is set like this:
Domain: SomeDomain.eu Domain: SomeDomain.nl
These both generate the id 1958, as can be seen in this jsfiddle
The effect this has is that if I edit items inside one section, the corresponding item in the other section gets updated too. It even generates some &ref references in the yaml config file when updating.
Additional info
No response
Please tick the boxes
- [X] You have explained the issue clearly, and included all relevant info
- [X] You are using a supported version of Dashy
- [X] You've checked that this issue hasn't already been raised
- [X] You've checked the docs and troubleshooting guide
- [X] You agree to the code of conduct
If you're enjoying Dashy, consider dropping us a ⭐
🤖 I'm a bot, and this message was automated
I didn't have any coffee yet when I created the bug report, as it was still early for me ;) But I guess this is due to the fact that the charcodes of 'eu' combined equal the value of the charcodes of 'nl' combined:
charcode n -> 110 charcode l -> 108 makes 218
charcode e -> 101 charcode u -> 117 makes 218
So 'unhappy' coincedence I guess.
I guess it could be fixed in a fashion similar to what I've done in this jsfiddle
Original
const charSum = sectionTitle.split('').map((a) => a.charCodeAt(0)).reduce((x, y) => x + y);
Improved
const charSum = sectionTitle.split('').map((a) => a.charCodeAt(0)).reduce((x, y) => ((x << 5) - x) + y) | 0;
This does produce a unique item id, even for the same input that clashed for me initially. The downside is that the unique id increases in size, from 4 to 10 digits.
This issue has gone 6 weeks without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days.
@liss-bot it is still relevant
This issue has gone 6 weeks without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days.
@liss-bot it is still relevant
This issue has gone 6 weeks without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days.
@liss-bot it is still relevant
This issue has gone 6 weeks without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days.
@liss-bot it is still relevant
This issue has gone 3 months without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days.
@liss-bot it is still relevant
This issue has gone 3 months without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days.
@liss-bot it is still relevant