Rename star/unstar actions to enable/disable/switch
Summary: Renamed actions "star" and "unstar" everywhere to "enable", "disable" and "switch". The logic behind original "star" action changed significantly, so this rename just makes everything much clearer. Please note that as a part of rename persisted state fields "userStarredPlugins" and "userStarredDevicePlugins" were renamed. I've added a "redux-persist" migration for seamless transition. Reviewed By: passy Differential Revision: D26606459 fbshipit-source-id: 83ad475f9b0231194701c40a2cdbda36f02c3d10
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e9bab76614
commit
fa3ff83595
@@ -31,7 +31,7 @@ import {PluginDefinition} from '../plugin';
|
||||
import PluginContainer from '../PluginContainer';
|
||||
import {getPluginKey, isDevicePluginDefinition} from '../utils/pluginUtils';
|
||||
import MockFlipper from './MockFlipper';
|
||||
import {starPlugin} from '../reducers/pluginManager';
|
||||
import {switchPlugin} from '../reducers/pluginManager';
|
||||
|
||||
export type MockFlipperResult = {
|
||||
client: Client;
|
||||
@@ -71,11 +71,9 @@ function isPluginEnabled(
|
||||
(!isDevicePluginDefinition(pluginClazz) &&
|
||||
store
|
||||
.getState()
|
||||
.connections.userStarredPlugins[selectedApp]?.includes(
|
||||
pluginClazz.id,
|
||||
)) ||
|
||||
.connections.enabledPlugins[selectedApp]?.includes(pluginClazz.id)) ||
|
||||
(isDevicePluginDefinition(pluginClazz) &&
|
||||
store.getState().connections.userStarredDevicePlugins.has(pluginClazz.id))
|
||||
store.getState().connections.enabledDevicePlugins.has(pluginClazz.id))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -108,7 +106,7 @@ export async function createMockFlipperWithPlugin(
|
||||
// enable the plugin
|
||||
if (!isPluginEnabled(store, pluginClazz, name)) {
|
||||
store.dispatch(
|
||||
starPlugin({
|
||||
switchPlugin({
|
||||
plugin: pluginClazz,
|
||||
selectedApp: client.query.app,
|
||||
}),
|
||||
@@ -118,7 +116,7 @@ export async function createMockFlipperWithPlugin(
|
||||
options?.additionalPlugins?.forEach((plugin) => {
|
||||
if (!isPluginEnabled(store, plugin, name)) {
|
||||
store.dispatch(
|
||||
starPlugin({
|
||||
switchPlugin({
|
||||
plugin,
|
||||
selectedApp: client.query.app,
|
||||
}),
|
||||
@@ -172,7 +170,7 @@ export async function createMockFlipperWithPlugin(
|
||||
throw new Error('unknown plugin ' + id);
|
||||
}
|
||||
store.dispatch(
|
||||
starPlugin({
|
||||
switchPlugin({
|
||||
plugin,
|
||||
selectedApp: client.query.app,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user