-
-
Notifications
You must be signed in to change notification settings - Fork 189
fix(rsc): isolate plugin state per plugin instance #747
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
fix(rsc): isolate plugin state per plugin instance #747
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Refactors RSC plugin state management from module-level global variables to an isolated RscPluginManager
class instance per plugin instance, enabling proper state isolation between multiple plugin instances.
Key changes:
- Introduces
RscPluginManager
class to encapsulate all plugin state - Updates all plugin functions to accept and use the manager instance
- Adds test to verify independent plugin state isolation during multiple builds
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
packages/plugin-rsc/src/plugin.ts | Removes global state variables, adds RscPluginManager class, and refactors all plugin functions to use manager instance |
packages/plugin-rsc/e2e/starter.test.ts | Adds test case to verify plugin state isolation between multiple builds |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Description
Currently all plugin states are managed in module scope (as a reminiscence of my original prototype). These states should be isolated per plugin instance. This also helps splitting up more plugins from single file
plugin.ts
. Also helps fixing an issues like #575.For now, let's do something mechanical by moving the state to
RscPluginManager
and just passing aroundmanager
. As a follow up, we could move some helpers to manager class such asassetURL
method.TODO