mirror of
https://github.com/stashapp/stash.git
synced 2025-12-16 20:07:05 +03:00
Throw error on re-registering component only if in prod environment (#5990)
This was causing an error when hot-reloading components, meaning that the components would not be refreshed.
This commit is contained in:
@@ -39,7 +39,13 @@ export function RegisterComponent<T extends Function>(
|
||||
) {
|
||||
// register with the plugin api
|
||||
if (components[component]) {
|
||||
throw new Error("Component " + component + " has already been registered");
|
||||
// only throw an error in production, in development we allow
|
||||
// multiple registrations to allow for hot reloading of components
|
||||
if (!import.meta.env.DEV) {
|
||||
throw new Error(
|
||||
"Component " + component + " has already been registered"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
components[component] = fn;
|
||||
|
||||
Reference in New Issue
Block a user