swc-jotai icon indicating copy to clipboard operation
swc-jotai copied to clipboard

Could we add a feature into `@swc-jotai/debug-label` so that this provides a fallback but otherwise uses a `.debugLabel` if one already exists?

Open sebinsua opened this issue 1 year ago • 1 comments

Could we add a feature into @swc-jotai/debug-label so that this provides a fallback label but otherwise uses a .debugLabel if one already exists?

e.g.

countAtom.debugLabel = countAtom.debugLabel ?? "countAtom";

The reason I'm interested in this, is that, often when I'm using atom families to create atoms, I give each atom a parameterised debug label relating to the params it was initialised with, etc.

I might attempt creating this if you're interested in the feature...

Note: I've just seen that one of your tests is that you don't add a label if one already exists, however, this doesn't work for me as I am using a helper function to apply debugLabel and debugPrivate.

sebinsua avatar Jun 20 '24 21:06 sebinsua

Good idea. Give it a shot and let's see if we like it.

Thisen avatar Aug 05 '24 12:08 Thisen