figma-plugin icon indicating copy to clipboard operation
figma-plugin copied to clipboard

When switching themes switch the figma native theme mode selector if possible

Open robinhoodie0823 opened this issue 1 year ago โ€ข 6 comments

https://github.com/tokens-studio/figma-plugin/assets/103296157/8769ec50-0d13-4b1c-9d0a-6797e8f65115

Closes #2187

robinhoodie0823 avatar Oct 25 '23 17:10 robinhoodie0823

๐Ÿฆ‹ Changeset detected

Latest commit: 21f2ae5dd2b082215aced240db6d01b42957aead

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@tokens-studio/figma-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Oct 25 '23 17:10 changeset-bot[bot]

PR Analysis

  • ๐ŸŽฏ Main theme: The main theme of this PR is to switch the Figma native theme mode selector when switching themes in the plugin.
  • ๐Ÿ“ PR summary: This PR introduces changes to the AsyncMessageChannel and setActiveTheme files. It adds functionality to switch the Figma native theme mode selector when switching themes in the plugin. It also updates the state when a new active theme is set.
  • ๐Ÿ“Œ Type of PR: Enhancement
  • ๐Ÿงช Relevant tests added: No
  • โฑ๏ธ Estimated effort to review [1-5]: 3, The PR introduces a new feature and modifies the state management, which requires a good understanding of the existing codebase and the new feature being introduced. However, the changes are not extensive and should be manageable to review.
  • ๐Ÿ”’ Security concerns: No

PR Feedback

  • ๐Ÿ’ก General suggestions: The code changes seem to be well implemented, but it would be beneficial to add error handling for the new code blocks. Also, it would be good to consider the performance implications of the forEach loop on figma.currentPage.children.

  • ๐Ÿค– Code feedback:

    • relevant file: src/AsyncMessageChannel.ts suggestion: Consider adding error handling for the new code block. If there's an error while setting the explicit variable mode for a collection, it should be caught and handled appropriately. [important] relevant line: figma.currentPage.children.forEach((frame) => {

    • relevant file: src/AsyncMessageChannel.ts suggestion: The forEach loop on figma.currentPage.children could potentially be expensive if there are many children. Consider if there's a more efficient way to achieve the same result. [medium] relevant line: figma.currentPage.children.forEach((frame) => {

How to use

To invoke the PR-Agent, add a comment using one of the following commands: /review [-i]: Request a review of your Pull Request. For an incremental review, which only considers changes since the last review, include the '-i' option. /describe: Modify the PR title and description based on the contents of the PR. /improve [--extended]: Suggest improvements to the code in the PR. Extended mode employs several calls, and provides a more thorough feedback. /ask <QUESTION>: Pose a question about the PR. /update_changelog: Update the changelog based on the PR's contents.

To edit any configuration parameter from configuration.toml, add --config_path=new_value For example: /review --pr_reviewer.extra_instructions="focus on the file: ..." To list the possible configuration parameters, use the /config command.

github-actions[bot] avatar Oct 25 '23 17:10 github-actions[bot]

Can you add a changeset so we can inform the users about this change?

Check to see if the fixes for the lookup fix the OOM error, otherwise we'll have to double check why that's occurring

SorsOps avatar Oct 26 '23 10:10 SorsOps

Tests are failing here

six7 avatar Nov 10 '23 16:11 six7

Commit SHA:4c507f93be36defe7933184695662c0f75d72629

Test coverage results :test_tube:

Code coverage diff between base branch:main and head branch: 2187-when-switching-themes-switch-the-figma-native-theme-mode-selector-if-possible 
Status File % Stmts % Branch % Funcs % Lines
:red_circle: total 70.73 (0.01) 61.08 (-0.02) 68.84 (-0.02) 70.98 (0.01)
:red_circle: src/AsyncMessageChannel.ts 94.91 (-3.09) 82.6 (-14.27) 92.85 (-7.15) 94.64 (-3.27)

github-actions[bot] avatar Jan 10 '24 01:01 github-actions[bot]

Commit SHA:4c507f93be36defe7933184695662c0f75d72629 Current PR reduces the test coverage percentage by 100 for some tests

github-actions[bot] avatar Jan 10 '24 01:01 github-actions[bot]