Skip to content
Gx
GitHub

GX5002: duplicate view-transition-name in one template

Two elements in one template have the same transition name.

Cause

Two elements in one template have the same transition name. The browser does not run a transition when two elements have one name.

Example

shop/Page.gx
package shop

<div>
  <img transition={Hero(1)} src="/a.png" alt="First" />
  <img transition={Hero(1)} src="/b.png" alt="Second" />
</div>
shop/transition.go
package shop

import "github.com/alternayte/gx"

// Hero pairs the product image of two pages.
var Hero = gx.Transition[int]("hero")

gx check reports:

gx check
shop/Page.gx:5:20: GX5002: duplicate transition "Hero(1)"; the browser skips a transition with a duplicate name

Fix

Give each element a different key, for example Hero(1) and Hero(2).