Skip to content

♻️ refactor(store): replace dynamic imports with static imports in actions#13159

Merged
Innei merged 1 commit into
lobehub:canaryfrom
Innei:refactor/store-static-imports
Mar 23, 2026
Merged

♻️ refactor(store): replace dynamic imports with static imports in actions#13159
Innei merged 1 commit into
lobehub:canaryfrom
Innei:refactor/store-static-imports

Conversation

@Innei

@Innei Innei commented Mar 20, 2026

Copy link
Copy Markdown
Member

💻 Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • ✅ test
  • 📝 docs
  • 🔨 chore

🔗 Related Issue

N/A

🔀 Description of Change

Replace redundant dynamic import() calls with top-level static imports in store actions where the module was already imported (or can be co-imported with existing symbols):

  • Plugin optimistic update: import dbMessageSelectors alongside displayMessageSelectors.
  • File manager: rely on existing documentService import from @/services/document.
  • User memory: import memoryCRUDService with userMemoryService from @/services/userMemory.

This keeps behavior the same while simplifying the module graph and avoiding unnecessary async import overhead in these paths.

🧪 How to Test

  • Tested locally
  • Added/updated tests
  • No tests needed

Smoke: open chat with plugins, rename a knowledge folder, update a memory entry — flows should behave as before.

📸 Screenshots / Videos

N/A (no UI changes)

📝 Additional Information

None

Made with Cursor

@lobehubbot

Copy link
Copy Markdown
Member

@ONLY-yours @nekomeowww - This refactor touches chat plugin actions, file manager, and user memory store. Please coordinate review.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We've reviewed this pull request using the Sourcery rules engine

@Innei Innei merged commit 9eca3d2 into lobehub:canary Mar 23, 2026
29 of 31 checks passed
@lobehubbot

Copy link
Copy Markdown
Member

❤️ Great PR @Innei ❤️

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.

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.

2 participants