mononym

mononym

I am building an SVG via LiveView to display a primitive map. This means I am drawing some squares with lines between them to indicate connections between areas and also throwing up some text labels as well. Nothing crazy and most things are working as expected.

However I’m noticing that the text nodes for the SVG are not being properly updated when something else changes. For example I might “highlight” one of the areas on the map which triggers a change to how that square is drawn to highlight the focused area. That will update correctly and draw correctly…but for some reason all of the text labels (which did not change at all) will be duplicated on the front end and I will get a cascade of errors from the browser about duplicate ID’s for elements.

This duplication will continue no matter how many times I trigger a change to other elements. So if I click a button to highlight 5 different areas/squares one right after the other I’ll get five more duplicate text elements. All other elements will be properly rendered once whether they were updated or not…this is limited only to the text elements.

I am not building duplicate text elements on the server side (the code used to build/update the map is exactly the same) so it seems like the disconnect might come from how LiveView does its diff between old and new. Maybe I’m doing something wrong that is causing it to add elements on the front end when it should be replacing them? Or maybe I actually found a bug?

Another bit of behavior that points to text not being properly handled with the diffs is that I can draw a map with text on it and it shows up correctly:

If I then, without reloading the page, trigger an update to the map which should draw two linked areas but not labels I get this:

This squares properly updated, meaning the old ones went away entirely and new ones were drawn, but the text lingered even though there is no text at all that should be drawn in the second example. If I load up that second map initially it looks like this:

Once again it looks like text is not being properly tracked/handled inside SVG’s even though rect and path appear to work just fine.

Where Next? Top

Trending in Questions Top

thiagogsr
** (ArgumentError) expected :max_attempts to be a positive integer, got: {:@, [line: 10, column: 19], [{:max_attempts, [line: 10, column:...
New
RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews