There is a fairly big difference in the behavior of getting the publish status of a component in a team library when you use
figma.importComponentByKeyAsync when you are in the main file and then when you use the same inside a branch.
I want to ask if this is intended behavior, or if they are meant to be functionally the same?
The documentation for
.getPublishStatusAsync here says that it “Gets the status of this style/component in the team library.” with no mention that the behavior is different if you’re in a branch or not.
What happens in a main file:
When a published component is called in the API with the method on the node
.getPublishStatusAsync, the code returns “CURRENT”
What happens in a branch:
The node returns “UNPUBLISHED”
Using the other method in either the main file or a branch:
figma.importComponentByKeyAsync(node.key) here it will return the published component. It says that it
Loads a component node from the team library. Promise is rejected if there is no published component with that key or if the request fails.
I don’t want to load the full component for everything I check as that can be computationally more expensive than just checking the publishStatus
I understand that functionally a branch is a new file, even if the underlying data is basically identical, it treats the node in a branch as a different entity than the node in the main file, yet, it would be important on something relying on checking for publish status to be.
Is the current state the desired result? Or would it make more sense to have the
.getPublishStatusAsync to function the same as the