MithrilJS / MithrilJS/mithril.js

Is there a bug with dynamically changing svgs?

Open
#2,886 15 comments 0 reactions 1 assignee View on GitHub

@dead-claudia is already working on this.

Since Oct 3, 2023.

Area: Core Status: Needs reproduction Type: Bug
Dominant language
JavaScript
Stars
14.5k
Forks
922
PR merge metrics
No merged PRs in 30d

Description

I have an array of numbers (assume 1 - 5) that is mapped to svgs for display. When the user clicks on a number, the svg changes . However, the wrong svg is often updated (so, clicking on 3 will update the svg for 5 instead of 3).

I suspect this is a mithril svg update problem. Here's why:

  1. Using the debugger and console.log show the code is behaving as expected.
  2. I have an option to display some html markup instead of the svgs, and that works as expected.
  3. The bug only appears after interaction/update--the initial display of the svg array is always correct.

I've tried hacking the key for the containing div, but that appears to make no difference.

Is this a known problem? Is there a work around?

I am using the current versions of Chrome and Edge.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.