Skip to content
Discussion options

You must be logged in to vote

Thanks for sharing this — the serializer is a solid approach for normalizing dynamic IDs in snapshots.

A few notes:

If you keep using snapshots: Your patterns look right for the main Ark/Zag ID formats. One thing to add: React 19.1+ uses guillemets («r1») instead of colons, so you may want to extend the serializer to handle that.

Simpler alternative: Zag doesn’t generate IDs — it uses whatever id you pass. That id is passed into the machine via the Root component (e.g. Dialog.Root, Select.Root). Zag builds part IDs as componentName:${id}:partName, so passing a fixed id makes all derived IDs stable. For example:

<Dialog.Root id="test-dialog"> <Dialog.Trigger>Open</Dialog.Trigger> <Dialog.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by segunadebayo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants