When writing Babel plugins, what can I assume about the same node being processed more than once? When or how can this happen? What are common protections if I don't want my annotations to appear twice? Should I always check if I've "seen" this node already?
-
-
Replying to @dan_abramov
You should always check if you’ve seen it. A WeakSet is the best option. There’s literally no memorable logic between when nodes are retraversed.
2 replies 0 retweets 9 likes -
Replying to @sebmck
Does path object have a shared lifetime with its node? Is path a bad key?
1 reply 0 retweets 0 likes -
Replying to @dan_abramov
Paths are associated with a parent and a key, the node object is fairly irrelevant. You should usually get the same Path instance for a given position, similar to React I think!
1 reply 0 retweets 2 likes
Replying to @sebmck @dan_abramov
https://github.com/babel/babel/blob/master/packages/babel-traverse/src/path/index.js#L73-L107 … for the Path creation and caching code
0 replies
0 retweets
1 like
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 