figma-plugin
figma-plugin copied to clipboard
When switching themes switch the figma native theme mode selector if possible
https://github.com/tokens-studio/figma-plugin/assets/103296157/8769ec50-0d13-4b1c-9d0a-6797e8f65115
Closes #2187
๐ฆ 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
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 onfigma.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: TheforEach
loop onfigma.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.
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
Tests are failing here
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) |
Commit SHA:4c507f93be36defe7933184695662c0f75d72629 Current PR reduces the test coverage percentage by 100 for some tests