Skip to main content
Question

[REST API issue] Local component "listed" but not existing in the document tree (but accessible via node endpoint)


Hi,

I’m facing a weird case:

When fetching a third-party file through /v1/files/xxx I see inside components the component 2:839. It’s marked remote: false and dozens of instances are using it through componentId: "2:839".

Unfortunately, the component definition does not exist in the document tree. I have to use the endpoint /v1/files/xxx/nodes?ids=2:839 to see it exists.

What could explain this? Did you see this before?

The file used is a design system from ~2020, I’m wondering if due to different Figma versions, evolutions… maybe the file as a corrupted tree?

EDIT: note that by using /v1/components/$COMPONENT_KEY, it returns 404 so it’s not a remote component wrongly noted as remote: false.

4 replies

tank666
  • 4859 replies
  • July 10, 2024

There is no bug here, and remote: false is specified correctly. If instance nodes refer to a local component that is not in the document’s children tree, this means that the node (the main component) has been deleted.


  • Author
  • 5 replies
  • July 10, 2024

@tank666 I guess there is no flag saying it’s deleted? I have to browse the entire tree to see if the component definition is inside?

What is the purpose of keeping a “ghost component” for all instances instead of turning the latter ones into raw shapes? Is it for people to kind of “swap” them all at once in case in the future they have a new component for them?


tank666
  • 4859 replies
  • July 10, 2024

Unfortunately, the REST API does not have the removed property, unlike the Plugin API. You can share your idea in the REST API category so that the Figma team will consider adding this property.

It turns out like this. You need to traverse the children tree looking for a node with COMPONENT type.

From a developer’s point of view, this is necessary to obtain the component’s source data, such as a name, description, documentation links, etc.


Gleb
  • Power Member
  • 4706 replies
  • July 10, 2024

In the UI you can click “Restore component” in case you deleted it by mistake or maybe it’s in the process of being moved to another file.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings