Skip to content

feat: improve plugin loading #1232

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

Merged

Conversation

bajrangCoder
Copy link
Collaborator

@bajrangCoder bajrangCoder commented Mar 27, 2025

Ref: #1106

  • load themes plugin on acode startup and load others after successfully starting acode
  • some minor biome config changes

- load themes plugin on acode startup
and load others after successfully starting acode
@bajrangCoder bajrangCoder requested a review from Copilot March 27, 2025 06:53
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the plugin loading process by introducing theme plugin filtering and ensuring theme plugins are loaded on startup while other plugins are loaded later. Key changes include:

  • Adding a set of theme identifiers and a helper function (isThemePlugin) to filter theme plugins.
  • Modifying the loadPlugins function to handle an "onlyTheme" flag.
  • Updating main.js to load theme plugins during startup with appropriate error handling.

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/lib/loadPlugins.js Refactored plugin loading with a new "onlyTheme" flag and added theme plugin logic via a set of identifiers.
src/lib/main.js Adjusted the plugin loading calls in onDeviceReady and loadApp to load theme plugins appropriately.
Files not reviewed (1)
  • biome.json: Language not supported
Comments suppressed due to low confidence (1)

src/lib/main.js:249

  • There is a duplicate call to applySettings.afterRender() within the setTimeout callback. Removing one of these calls may prevent redundant re-rendering and improve performance.
applySettings.afterRender();

@bajrangCoder bajrangCoder requested a review from Copilot March 27, 2025 07:09
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the plugin loading process by introducing theme-based filtering and modifying when plugins are loaded during app startup.

  • Introduces filtering and early loading for theme plugins using a new isThemePlugin helper.
  • Updates the plugin loading invocation in main.js with asynchronous handling and refined error messages.

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
src/lib/loadPlugins.js Adds theme identifiers and filters plugins based on the current theme.
src/lib/main.js Updates plugin loading calls by wrapping code in async setTimeout callbacks and differentiating between theme and non-theme plugins.
Files not reviewed (1)
  • biome.json: Language not supported
Comments suppressed due to low confidence (1)

src/lib/main.js:242

  • The invocation of loadPlugins() does not pass the 'true' argument, yet the error message indicates that theme plugins are expected. Consider changing the call to loadPlugins(true) or updating the error message to accurately reflect the functionality.
await loadPlugins();

@bajrangCoder bajrangCoder requested a review from Copilot March 27, 2025 07:12
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the plugin loading functionality by separating theme plugin loading on startup from loading other plugins afterward, and it updates the logging and documentation accordingly.

  • In src/lib/main.js, the startup process now loads theme plugins immediately and other plugins later.
  • In src/lib/loadPlugins.js, the function now accepts a flag to filter for theme plugins only and refines the filtering logic and logging messages.

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/lib/main.js Modified async behavior in setTimeout and updated plugin loading messages.
src/lib/loadPlugins.js Added a parameter to filter theme plugins and adjusted error logging.
Files not reviewed (1)
  • biome.json: Language not supported
Comments suppressed due to low confidence (1)

src/lib/loadPlugins.js:26

  • [nitpick] Consider renaming 'onlyTheme' to 'loadOnlyTheme' for improved clarity regarding the function’s behavior.
export default async function loadPlugins(onlyTheme = false) {

@bajrangCoder bajrangCoder changed the title feat: imrpove plugin loading feat: improve plugin loading Mar 27, 2025
@bajrangCoder bajrangCoder merged commit feade49 into Acode-Foundation:main Mar 27, 2025
2 checks passed
@bajrangCoder bajrangCoder deleted the load-plugin-optimisation branch May 9, 2025 16:27
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

Successfully merging this pull request may close these issues.

1 participant