Skip to content

Commit

Permalink
Force React to not diff the scatter-plot and just re-render the whole…
Browse files Browse the repository at this point in the history
… thing (#19)
  • Loading branch information
mjkw31 authored Jan 20, 2025
1 parent a9b5480 commit f37e9e8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/static/wrstat/src/Scatter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ type Data = {
Mtime: string;
}

let scatterKey = 0;

const minDaysAgo = (date: string) => {
const daysAgo = asDaysAgo(date);
if (daysAgo < 0) {
Expand Down Expand Up @@ -232,7 +234,7 @@ const minDaysAgo = (date: string) => {
const xScale = graphWidth / (maxDate - minDate),
yScale = graphHeight / (maxSize - minSize);

return <svg id="scatter" xmlns="http://www.w3.org/2000/svg" width={width} height={height} viewBox={`0 0 ${width} ${height}`} onMouseDown={onDrag}>
return <svg id="scatter" key={`scatter_${++scatterKey}`} xmlns="http://www.w3.org/2000/svg" width={width} height={height} viewBox={`0 0 ${width} ${height}`} onMouseDown={onDrag}>
<defs>
<circle id="marker" r="2.5" />
</defs>
Expand Down

0 comments on commit f37e9e8

Please sign in to comment.