Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stylesLookup error #35

Open
HaleyWardo opened this issue Nov 20, 2024 · 0 comments
Open

stylesLookup error #35

HaleyWardo opened this issue Nov 20, 2024 · 0 comments

Comments

@HaleyWardo
Copy link

HaleyWardo commented Nov 20, 2024

At my organization, we have our Design System architected a different way in Figma. Our library is a part of an entire team that includes features as well. So we aren't able to fetch components / styles at a team level. We have three different files for each platform (Web, iOS, and Android).

With that said, I am getting the components and styles without using figmaCalculator's loadComponents and loadStyles since we need to get these via the file endpoints. Then I am passing allStyles and components with these returned responses into the processTree arguments.

// These functions match 1:1 to the figmaCalculator methods and corresponding API helpers. 
// The only differences are the endpoints. 
const components = await getLibraryComponents(libraryId);
const styles = await getLibraryStyles(libraryId); 

for (const file of files) {
  const processedNodes = figmaCalculator.processTree(page, {
     allStyles: styles,
     components
  });
}

I am getting this error

Cannot read properties of undefined (reading ${companyName}SansVF<->31)

on this line of code.

When I fork the code and optionally chain this if check, the error resolves and I can get the team breakdown. However, I want to make sure I am not missing something and potentially getting inaccurate usage counts.


Another metric we are trying to get is detachments. We've implemented a signature component to all of our library components in order to track detachments. I was hoping to be able to pass in a callback of some sort to have other conditions / outputs to the processTree. I noticed that processTree has an onProcessNode argument, but I am not sure if we can leverage that. Maybe we will just need to recurse through the page nodes again to get this metric outside of using figmaCalculator. 🤔

I still need to dig in more, but I wonder if you all have any ideas that come to mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant