Template API V2: `findLayers` doesn't work with `path`

Open
#325 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript

Research direction

Start by locating the Template API V2 implementation of findLayers and compare its handling of the path option with findConnectedInstances, which the report says works. Reproduce the error with path: ['parentLayerName'] and path: []; done means findLayers accepts the documented option or the documentation is corrected to match its supported behavior.

Written by the indexing model from the issue text.

Description

API question

Hi everyone,

I can't get findLayers() to work with the path prop, even though the docs say that it should work.

Image Image

I'm using Template API V2.

instance.findLayers((child) => true) works fine

instance.findConnectedInstances((child) => true, { path: ['parentLayerName'], }) also works fine

but just calling instance.findLayers((child) => true, { path: ['parentLayerName'] })
or even instance.findLayers((child) => true, { path: [] })
immediately gets me an error, even before using the result in any way:
Image

Am I doing something wrong, or is there a bug in findLayers, or maybe it's described incorrectly in the docs and doesn't actually accept path?

Dominant language
TypeScript
Stars
1.6k
Forks
126
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from figma/code-connect

All issues in figma/code-connect

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.