-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* refactor rename extensions -> activatedModComponents * refactor rename uninstallAllDeployments -> deactivateAllDeployedMods * refactor rename vars in deactivateAllDeployedMods * refactor rename uninstallExtensionsAndSaveState -> deactivateModComponentsAndSaveState * refactor rename vars in deactivateModComponentsAndSaveState * reactor rename uninstallExtensinoFromStates -> deactivateModComponentFromStates * refactor rename setExtensionsState -> saveModComponentStateAndReactivateTabs * refactor rename uninstallUmnatchedDeployments -> deactivateUnassignedDeployments * refactor rename uninstallRecipe -> deactivateMod * refactor rename installDeployment -> activateDeployment * refactor rename installDeployments -> activateDeployments * refacto rename canAutomaticallyInstall -> canAutoActivate * refactor rename vars in activateDeploymentsInBackground * refactor clarify manual/auto activation logic in activateDeploymentsInBackground * refactor consolidate resetUpdateTimestamp func * replace straggling references to 'install' with 'activate' * add test for changing mod id * fix test inteference in deploymentUpdater * add empty test file for activateDeployments * fix name and docs for updatePromptTimestamp * refactor integrate graham suggestion * add empty test to DeploymentsContext * add basic test body * update deployment timestamps * fix type errors * fix registry id in test * finish replication test * refactor rename activateDeployment param installed -> activatedModComponents * refactor rename activateDeployments param installed -> activatedModComponents * refactor consolidate redundant prop * refactor rename extension -> modComponent * bugfix deactivate mods based on deloyment id instead of recipe id * Refactor improve deploymentOverride spread * refactor extract mockDeploymentActivationRequests * add test for unmanaged activated mod becoming managed * fix type errors * fix modcomponentstate tyep errors * misc refactors * fix lint errors * add restricted flags mock * make fix for deactivate unmananged mod components * remove deactivate unassigned * remove todos in tests * add unassignedModComponents to deploymentUpdateState * refactor rename activeExtensions -> activeModComponents * refactor rename installedExtensions -> activatedModComponents * add unassignedModComponents to useAutoDeploy * deactivate unassigned mod components in useAutoDeploy effect * fix autoDeploy tests * remove unnecessary async * fix lint errors' * add try catch to deactivateUnassignedModComponents * fix lint errors * create useDeactivateUnassignedDeploymentsEffect * replace useAutoDeploy deactivateUnassignedModComponents with effect * replace useAutoDeploy deactivateUnassignedModComponents with effect * remove from strictnull
- Loading branch information
Showing
5 changed files
with
124 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/extensionConsole/pages/deployments/useDeactivateUnassignedDeploymentsEffect.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (C) 2024 PixieBrix, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { deactivateUnassignedModComponents } from "@/extensionConsole/pages/deployments/activateDeployments"; | ||
import { useEffect } from "react"; | ||
import { useDispatch } from "react-redux"; | ||
import type { Dispatch } from "@reduxjs/toolkit"; | ||
import { type ModComponentBase } from "@/types/modComponentTypes"; | ||
|
||
const useDeactivateUnassignedDeploymentsEffect = ( | ||
unassignedModComponents: ModComponentBase[], | ||
) => { | ||
const dispatch = useDispatch<Dispatch>(); | ||
useEffect(() => { | ||
if (unassignedModComponents.length === 0) return; | ||
|
||
deactivateUnassignedModComponents({ | ||
dispatch, | ||
unassignedModComponents, | ||
}); | ||
}, [unassignedModComponents]); | ||
}; | ||
|
||
export default useDeactivateUnassignedDeploymentsEffect; |