Skip to content

Commit

Permalink
fix: going to "Statistics" crashing the app
Browse files Browse the repository at this point in the history
When there are labels with >1 byte Unicode characters
See https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem

Using `btoa()` for `key=` seems to be unnecessary. React docs
say nothing about it
https://react.dev/learn/rendering-lists
Plus I tested it. Works alright.
  • Loading branch information
WofWca authored and Simon-Laux committed May 25, 2024
1 parent b78f3ca commit 03c26bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- fix: going to "Statistics" crashing the app sometimes

## 0.8.0

- small style fixes for stats view on small screens
Expand Down
4 changes: 2 additions & 2 deletions src/components/StatsTaskDistribution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function TaskDistributionPie({
{labelsSortedWithPercentage.map((label) => (
<tr>
<td
key={btoa(label.label) + "-" + label.percentage}
key={label.label + "-" + label.percentage}
style={{ "--start": label.start, "--end": label.end }}
>
<span className="data"></span>
Expand All @@ -96,7 +96,7 @@ export function TaskDistributionPie({
{labelsSortedWithPercentage.map((label) => (
<li
className="w-full flex"
key={btoa(label.label) + "-" + label.percentage}
key={label.label + "-" + label.percentage}
>
<span className="flex-grow">
{label.label}: (
Expand Down

0 comments on commit 03c26bb

Please sign in to comment.