This commit is contained in:
Nathan Bierema 2021-08-22 18:29:08 -04:00
parent ca68117921
commit 3415f57757
15 changed files with 128 additions and 67 deletions

View File

@ -67,11 +67,11 @@ export function isFiltered<A extends Action<unknown>>(
function filterActions<A extends Action<unknown>>( function filterActions<A extends Action<unknown>>(
actionsById: { [p: number]: PerformAction<A> }, actionsById: { [p: number]: PerformAction<A> },
actionSanitizer: ((action: A, id: number) => A) | undefined actionSanitizer: ((action: A, id: number) => A) | undefined
) { ): { [p: number]: PerformAction<A> } {
if (!actionSanitizer) return actionsById; if (!actionSanitizer) return actionsById;
return mapValues(actionsById, (action, id: number) => ({ return mapValues(actionsById, (action, id) => ({
...action, ...action,
action: actionSanitizer(action.action, id), action: actionSanitizer(action.action, id as unknown as number),
})); }));
} }
@ -92,7 +92,7 @@ export function filterState<S, A extends Action<unknown>>(
stateSanitizer: ((state: S, index: number) => S) | undefined, stateSanitizer: ((state: S, index: number) => S) | undefined,
actionSanitizer: ((action: A, id: number) => A) | undefined, actionSanitizer: ((action: A, id: number) => A) | undefined,
predicate: ((state: S, action: A) => boolean) | undefined predicate: ((state: S, action: A) => boolean) | undefined
) { ): LiftedState<S, A, unknown> {
if (predicate || !noFiltersApplied(localFilter)) { if (predicate || !noFiltersApplied(localFilter)) {
const filteredStagedActionIds: number[] = []; const filteredStagedActionIds: number[] = [];
const filteredComputedStates: { state: S; error?: string | undefined }[] = const filteredComputedStates: { state: S; error?: string | undefined }[] =

View File

@ -174,7 +174,7 @@ interface SerializedActionMessage {
readonly instanceId: number; readonly instanceId: number;
readonly action: string; readonly action: string;
readonly maxAge: number; readonly maxAge: number;
readonly nextActionId: number; readonly nextActionId?: number;
} }
interface SerializedStateMessage<S, A extends Action<unknown>> { interface SerializedStateMessage<S, A extends Action<unknown>> {
@ -320,7 +320,7 @@ interface ExportMessage<S, A extends Action<unknown>> {
readonly instanceId: number; readonly instanceId: number;
} }
interface StructuralPerformAction<A extends Action<unknown>> { export interface StructuralPerformAction<A extends Action<unknown>> {
readonly action: A; readonly action: A;
readonly timestamp?: number; readonly timestamp?: number;
readonly stack?: string; readonly stack?: string;
@ -341,7 +341,8 @@ interface ActionMessage<S, A extends Action<unknown>> {
readonly instanceId: number; readonly instanceId: number;
readonly action: UserAction<A>; readonly action: UserAction<A>;
readonly maxAge: number; readonly maxAge: number;
readonly nextActionId: number; readonly nextActionId?: number;
readonly name?: string;
} }
interface StateMessage<S, A extends Action<unknown>> { interface StateMessage<S, A extends Action<unknown>> {
@ -350,6 +351,9 @@ interface StateMessage<S, A extends Action<unknown>> {
readonly source: typeof source; readonly source: typeof source;
readonly instanceId: number; readonly instanceId: number;
readonly libConfig?: LibConfig; readonly libConfig?: LibConfig;
readonly action?: UserAction<A>;
readonly maxAge?: number;
readonly name?: string;
} }
export interface ErrorMessage { export interface ErrorMessage {
@ -439,7 +443,7 @@ export function toContentScript<S, A extends Action<unknown>>(
export function sendMessage<S, A extends Action<unknown>>( export function sendMessage<S, A extends Action<unknown>>(
action: StructuralPerformAction<A> | StructuralPerformAction<A>[], action: StructuralPerformAction<A> | StructuralPerformAction<A>[],
state: S, state: LiftedState<S, A, unknown>,
config: Config, config: Config,
instanceId?: number, instanceId?: number,
name?: string name?: string
@ -456,16 +460,16 @@ export function sendMessage<S, A extends Action<unknown>>(
type: 'ACTION', type: 'ACTION',
action: amendedAction, action: amendedAction,
payload: state, payload: state,
maxAge: config.maxAge, maxAge: config.maxAge!,
source, source,
name: config.name || name, name: config.name || name,
instanceId: config.instanceId || instanceId || 1, instanceId: config.instanceId || instanceId || 1,
}, },
config.serialize, config.serialize as Serialize | undefined,
config.serialize config.serialize as Serialize | undefined
); );
} }
toContentScript( toContentScript<S, A>(
{ {
type: 'STATE', type: 'STATE',
action: amendedAction, action: amendedAction,
@ -475,8 +479,8 @@ export function sendMessage<S, A extends Action<unknown>>(
name: config.name || name, name: config.name || name,
instanceId: config.instanceId || instanceId || 1, instanceId: config.instanceId || instanceId || 1,
}, },
config.serialize, config.serialize as Serialize | undefined,
config.serialize config.serialize as Serialize | undefined
); );
} }
@ -530,7 +534,23 @@ export function disconnect() {
post({ type: 'DISCONNECT', source }); post({ type: 'DISCONNECT', source });
} }
export function connect(preConfig: Config) { export interface ConnectResponse {
init: <S, A extends Action<unknown>>(
state: S,
liftedData: LiftedState<S, A, unknown>
) => void;
subscribe: <S, A extends Action<unknown>>(
listener: (message: ListenerMessage<S, A>) => void
) => (() => void) | undefined;
unsubscribe: () => void;
send: <S, A extends Action<unknown>>(
action: A,
state: LiftedState<S, A, unknown>
) => void;
error: (payload: string) => void;
}
export function connect(preConfig: Config): ConnectResponse {
const config = preConfig || {}; const config = preConfig || {};
const id = generateId(config.instanceId); const id = generateId(config.instanceId);
if (!config.instanceId) config.instanceId = id; if (!config.instanceId) config.instanceId = id;
@ -546,7 +566,7 @@ export function connect(preConfig: Config) {
const autoPause = config.autoPause; const autoPause = config.autoPause;
let isPaused = autoPause; let isPaused = autoPause;
let delayedActions: StructuralPerformAction<Action<unknown>>[] = []; let delayedActions: StructuralPerformAction<Action<unknown>>[] = [];
let delayedStates: unknown[] = []; let delayedStates: LiftedState<unknown, Action<unknown>, unknown>[] = [];
const rootListener = (action: ContentScriptToPageScriptMessage) => { const rootListener = (action: ContentScriptToPageScriptMessage) => {
if (autoPause) { if (autoPause) {
@ -590,12 +610,15 @@ export function connect(preConfig: Config) {
}; };
const sendDelayed = throttle(() => { const sendDelayed = throttle(() => {
sendMessage(delayedActions, delayedStates, config); sendMessage(delayedActions, delayedStates as any, config);
delayedActions = []; delayedActions = [];
delayedStates = []; delayedStates = [];
}, latency); }, latency);
const send = <S, A extends Action<unknown>>(action: A, state: S) => { const send = <S, A extends Action<unknown>>(
action: A,
state: LiftedState<S, A, unknown>
) => {
if ( if (
isPaused || isPaused ||
isFiltered(action, localFilter) || isFiltered(action, localFilter) ||
@ -684,13 +707,10 @@ export function connect(preConfig: Config) {
export function updateStore<S, A extends Action<unknown>>( export function updateStore<S, A extends Action<unknown>>(
stores: { stores: {
[K in string | number]: EnhancedStore<S, Action<A>, unknown>; [K in string | number]: EnhancedStore<S, A, unknown>;
} }
) { ) {
return function ( return function (newStore: EnhancedStore<S, A, unknown>, instanceId: number) {
newStore: EnhancedStore<S, Action<A>, unknown>,
instanceId: number
) {
/* eslint-disable no-console */ /* eslint-disable no-console */
console.warn( console.warn(
'`__REDUX_DEVTOOLS_EXTENSION__.updateStore` is deprecated, remove it and just use ' + '`__REDUX_DEVTOOLS_EXTENSION__.updateStore` is deprecated, remove it and just use ' +

View File

@ -82,9 +82,9 @@ interface ExportAction extends TabMessageBase {
readonly id: string; readonly id: string;
} }
interface NAAction { export interface NAAction {
readonly type: 'NA'; readonly type: 'NA';
readonly id: string; readonly id: string | number;
} }
interface InitMessage<S, A extends Action<unknown>> { interface InitMessage<S, A extends Action<unknown>> {
@ -99,10 +99,10 @@ interface InitMessage<S, A extends Action<unknown>> {
} }
interface LiftedMessage { interface LiftedMessage {
readonly type: 'LIFTED'; type: 'LIFTED';
readonly liftedState: { readonly isPaused: boolean | undefined }; liftedState: { isPaused: boolean | undefined };
instanceId: number; instanceId: number;
readonly source: '@devtools-page'; source: '@devtools-page';
} }
interface SerializedPartialLiftedState { interface SerializedPartialLiftedState {
@ -162,7 +162,7 @@ type UpdateStateRequest<S, A extends Action<unknown>> =
| SerializedActionMessage | SerializedActionMessage
| SerializedStateMessage<S, A>; | SerializedStateMessage<S, A>;
interface EmptyUpdateStateAction { export interface EmptyUpdateStateAction {
readonly type: typeof UPDATE_STATE; readonly type: typeof UPDATE_STATE;
} }

View File

@ -28,7 +28,7 @@ const syncStores =
const instances = store.getState().instances; const instances = store.getState().instances;
const instanceId = getActiveInstance(instances); const instanceId = getActiveInstance(instances);
const id = instances.options[instanceId].connectionId; const id = instances.options[instanceId].connectionId;
baseStore.dispatch({ ...action, instanceId, id }); baseStore.dispatch({ ...action, instanceId, id } as any);
} }
return next(action); return next(action);
}; };

View File

@ -7,7 +7,10 @@ import {
SELECT_INSTANCE, SELECT_INSTANCE,
LIFTED_ACTION, LIFTED_ACTION,
} from '@redux-devtools/app/lib/constants/actionTypes'; } from '@redux-devtools/app/lib/constants/actionTypes';
import { WindowStoreAction } from '../../stores/windowStore'; import {
ExpandedUpdateStateAction,
WindowStoreAction,
} from '../../stores/windowStore';
export default function instances( export default function instances(
state = initialState, state = initialState,
@ -15,7 +18,10 @@ export default function instances(
) { ) {
switch (action.type) { switch (action.type) {
case UPDATE_STATE: case UPDATE_STATE:
return { ...action.instances, selected: state.selected }; return {
...(action as ExpandedUpdateStateAction).instances,
selected: state.selected,
};
case LIFTED_ACTION: case LIFTED_ACTION:
if (action.message === 'DISPATCH') return dispatchAction(state, action); if (action.message === 'DISPATCH') return dispatchAction(state, action);
return state; return state;

View File

@ -21,6 +21,7 @@ import instanceSelector from '../middlewares/instanceSelector';
import rootReducer from '../reducers/window'; import rootReducer from '../reducers/window';
import { BackgroundState } from '../reducers/background'; import { BackgroundState } from '../reducers/background';
import { BackgroundAction } from './backgroundStore'; import { BackgroundAction } from './backgroundStore';
import { EmptyUpdateStateAction, NAAction } from '../middlewares/api';
export interface TogglePersistAction { export interface TogglePersistAction {
readonly type: 'TOGGLE_PERSIST'; readonly type: 'TOGGLE_PERSIST';
@ -28,14 +29,16 @@ export interface TogglePersistAction {
export type StoreActionWithTogglePersist = StoreAction | TogglePersistAction; export type StoreActionWithTogglePersist = StoreAction | TogglePersistAction;
interface ExpandedUpdateStateAction extends UpdateStateAction { export interface ExpandedUpdateStateAction extends UpdateStateAction {
readonly instances: InstancesState; readonly instances: InstancesState;
} }
export type WindowStoreAction = export type WindowStoreAction =
| StoreActionWithoutUpdateState | StoreActionWithoutUpdateState
| TogglePersistAction | TogglePersistAction
| ExpandedUpdateStateAction; | ExpandedUpdateStateAction
| NAAction
| EmptyUpdateStateAction;
export default function configureStore( export default function configureStore(
baseStore: Store<BackgroundState, BackgroundAction>, baseStore: Store<BackgroundState, BackgroundAction>,
@ -68,7 +71,7 @@ export default function configureStore(
hostname: options['s:hostname'], hostname: options['s:hostname'],
port: options['s:port'], port: options['s:port'],
secure: options['s:secure'], secure: options['s:secure'],
}, } as any,
}); });
}); });

View File

@ -1,7 +1,7 @@
import { PreloadedState } from 'redux'; import { PreloadedState } from 'redux';
import { StoreState } from '@redux-devtools/app/lib/reducers'; import { StoreState } from '@redux-devtools/app/lib/reducers';
const getIfExists = (sel, template) => const getIfExists = (sel: any, template: any) =>
typeof sel === 'undefined' || typeof sel === 'undefined' ||
typeof template === 'undefined' || typeof template === 'undefined' ||
typeof template[sel] === 'undefined' typeof template[sel] === 'undefined'
@ -34,7 +34,7 @@ export default function getPreloadedState(
), ),
templates: options['test-templates'], templates: options['test-templates'],
}, },
}); } as any);
} }
); );
} }

View File

@ -9,8 +9,8 @@ import getPreloadedState from '../background/getPreloadedState';
import '../../views/devpanel.pug'; import '../../views/devpanel.pug';
import { Action, PreloadedState, Store } from 'redux'; import { Action, PreloadedState, Store } from 'redux';
import { StoreState } from '@redux-devtools/app/lib/reducers'; import { StoreState } from '@redux-devtools/app/lib/reducers';
import { StoreAction } from '@redux-devtools/app/lib/actions';
import { PanelMessage } from '../../../app/middlewares/api'; import { PanelMessage } from '../../../app/middlewares/api';
import { StoreActionWithTogglePersist } from '../../../app/stores/windowStore';
const position = location.hash; const position = location.hash;
const messageStyle: CSSProperties = { const messageStyle: CSSProperties = {
@ -20,7 +20,7 @@ const messageStyle: CSSProperties = {
}; };
let rendered: boolean | undefined; let rendered: boolean | undefined;
let store: Store<StoreState, StoreAction> | undefined; let store: Store<StoreState, StoreActionWithTogglePersist> | undefined;
let bgConnection: chrome.runtime.Port; let bgConnection: chrome.runtime.Port;
let naTimeout: NodeJS.Timeout; let naTimeout: NodeJS.Timeout;
let preloadedState: PreloadedState<StoreState>; let preloadedState: PreloadedState<StoreState>;

View File

@ -213,7 +213,7 @@ function tryCatch<S, A extends Action<unknown>>(
return fn(args); return fn(args);
} catch (err) { } catch (err) {
if (err.message === 'Message length exceeded maximum allowed length.') { if (err.message === 'Message length exceeded maximum allowed length.') {
const instanceId = args.instanceId; const instanceId = (args as any).instanceId;
const newArgs = { const newArgs = {
split: 'start', split: 'start',
}; };
@ -231,7 +231,7 @@ function tryCatch<S, A extends Action<unknown>>(
} }
newArgs[key as keyof typeof newArgs] = arg; newArgs[key as keyof typeof newArgs] = arg;
}); });
fn(newArgs); fn(newArgs as any);
for (let i = 0; i < toSplit.length; i++) { for (let i = 0; i < toSplit.length; i++) {
for (let j = 0; j < toSplit[i][1].length; j += maxChromeMsgSize) { for (let j = 0; j < toSplit[i][1].length; j += maxChromeMsgSize) {
fn({ fn({

View File

@ -7,6 +7,7 @@ import throttle from 'lodash/throttle';
import { import {
Action, Action,
ActionCreator, ActionCreator,
Dispatch,
PreloadedState, PreloadedState,
Reducer, Reducer,
Store, Store,
@ -14,7 +15,7 @@ import {
StoreEnhancerStoreCreator, StoreEnhancerStoreCreator,
} from 'redux'; } from 'redux';
import Immutable from 'immutable'; import Immutable from 'immutable';
import { EnhancedStore } from '@redux-devtools/instrument'; import { EnhancedStore, PerformAction } from '@redux-devtools/instrument';
import createStore from '../../../app/stores/createStore'; import createStore from '../../../app/stores/createStore';
import configureStore, { getUrlParam } from '../../../app/stores/enhancerStore'; import configureStore, { getUrlParam } from '../../../app/stores/enhancerStore';
import { isAllowed, Options } from '../options/syncOptions'; import { isAllowed, Options } from '../options/syncOptions';
@ -40,6 +41,8 @@ import {
isInIframe, isInIframe,
getSerializeParameter, getSerializeParameter,
Serialize, Serialize,
StructuralPerformAction,
ConnectResponse,
} from '../../../app/api'; } from '../../../app/api';
import { LiftedAction, LiftedState } from '@redux-devtools/instrument'; import { LiftedAction, LiftedState } from '@redux-devtools/instrument';
import { import {
@ -50,9 +53,19 @@ import {
import { ContentScriptToPageScriptMessage } from './contentScript'; import { ContentScriptToPageScriptMessage } from './contentScript';
import { Features } from '@redux-devtools/app/lib/reducers/instances'; import { Features } from '@redux-devtools/app/lib/reducers/instances';
type EnhancedStoreWithInitialDispatch<
S,
A extends Action<unknown>,
MonitorState
> = EnhancedStore<S, A, MonitorState> & { initialDispatch: Dispatch<A> };
const source = '@devtools-page'; const source = '@devtools-page';
let stores: { let stores: {
[K in string | number]: EnhancedStore<unknown, Action<unknown>, unknown>; [K in string | number]: EnhancedStoreWithInitialDispatch<
unknown,
Action<unknown>,
unknown
>;
} = {}; } = {};
let reportId: string | null | undefined; let reportId: string | null | undefined;
@ -137,7 +150,23 @@ interface ReduxDevtoolsExtension {
): Store<S, A>; ): Store<S, A>;
(config?: Config): StoreEnhancer; (config?: Config): StoreEnhancer;
open: (position?: Position) => void; open: (position?: Position) => void;
updateStore: (
newStore: EnhancedStore<unknown, Action<unknown>, unknown>,
instanceId: number
) => void;
notifyErrors: (onError?: () => boolean) => void; notifyErrors: (onError?: () => boolean) => void;
send: <S, A extends Action<unknown>>(
action: StructuralPerformAction<A> | StructuralPerformAction<A>[],
state: LiftedState<S, A, unknown>,
config: Config,
instanceId?: number,
name?: string
) => void;
listen: (
onMessage: (message: ContentScriptToPageScriptMessage) => void,
instanceId: number
) => void;
connect: (preConfig: Config) => ConnectResponse;
disconnect: () => void; disconnect: () => void;
} }
@ -157,16 +186,16 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
reducer?: Reducer<S, A> | Config | undefined, reducer?: Reducer<S, A> | Config | undefined,
preloadedState?: PreloadedState<S>, preloadedState?: PreloadedState<S>,
config?: Config config?: Config
) { ): Store<S, A> | StoreEnhancer {
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */
if (typeof reducer === 'object') { if (typeof reducer === 'object') {
config = reducer; config = reducer;
reducer = undefined; reducer = undefined;
} else if (typeof config !== 'object') config = {}; } else if (typeof config !== 'object') config = {};
/* eslint-enable no-param-reassign */ /* eslint-enable no-param-reassign */
if (!window.devToolsOptions) window.devToolsOptions = {}; if (!window.devToolsOptions) window.devToolsOptions = {} as any;
let store: EnhancedStore<S, A, unknown>; let store: EnhancedStoreWithInitialDispatch<S, A, unknown>;
let errorOccurred = false; let errorOccurred = false;
let maxAge: number | undefined; let maxAge: number | undefined;
let actionCreators: readonly ActionCreatorObject[]; let actionCreators: readonly ActionCreatorObject[];
@ -404,7 +433,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
store.liftedStore.dispatch({ type: action.type, index }); store.liftedStore.dispatch({ type: action.type, index });
return; return;
} }
store.liftedStore.dispatch(action); store.liftedStore.dispatch(action as any);
} }
function onMessage(message: ContentScriptToPageScriptMessage) { function onMessage(message: ContentScriptToPageScriptMessage) {
@ -479,12 +508,12 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
if ( if (
!liftedAction || !liftedAction ||
noFiltersApplied(localFilter) || noFiltersApplied(localFilter) ||
!liftedAction.action !(liftedAction as PerformAction<A>).action
) { ) {
return m; return m;
} }
if (!maxAge || maxAge < m) maxAge = m; // it can be modified in process on options page if (!maxAge || maxAge < m) maxAge = m; // it can be modified in process on options page
if (isFiltered(liftedAction.action, localFilter)) { if (isFiltered((liftedAction as PerformAction<A>).action, localFilter)) {
// TODO: check also predicate && !predicate(state, action) with current state // TODO: check also predicate && !predicate(state, action) with current state
maxAge++; maxAge++;
} else { } else {
@ -554,10 +583,10 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
} }
const enhance = const enhance =
() => (): StoreEnhancer =>
<NextExt, NextStateExt>( <NextExt, NextStateExt>(
next: StoreEnhancerStoreCreator<NextExt, NextStateExt> next: StoreEnhancerStoreCreator<NextExt, NextStateExt>
) => { ): any => {
return <S2 extends S, A2 extends A>( return <S2 extends S, A2 extends A>(
reducer_: Reducer<S2, A2>, reducer_: Reducer<S2, A2>,
initialState_?: PreloadedState<S2> initialState_?: PreloadedState<S2>
@ -568,7 +597,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
return configureStore(next, monitor.reducer, { return configureStore(next, monitor.reducer, {
...config, ...config,
maxAge: getMaxAge, maxAge: getMaxAge as any,
})(reducer_, initialState_); })(reducer_, initialState_);
if (isInIframe()) setTimeout(init, 3000); if (isInIframe()) setTimeout(init, 3000);
@ -610,24 +639,27 @@ const preEnhancer =
const store = next(reducer, preloadedState); const store = next(reducer, preloadedState);
if (stores[instanceId]) { if (stores[instanceId]) {
stores[instanceId].initialDispatch = store.dispatch; (stores[instanceId].initialDispatch as any) = store.dispatch;
} }
return { return {
...store, ...store,
dispatch: (...args) => dispatch: (...args: any[]) =>
!window.__REDUX_DEVTOOLS_EXTENSION_LOCKED__ && store.dispatch(...args), !window.__REDUX_DEVTOOLS_EXTENSION_LOCKED__ &&
}; (store.dispatch as any)(...args),
} as any;
}; };
const extensionCompose = const extensionCompose =
(config: Config) => (config: Config) =>
(...funcs: StoreEnhancer[]) => { (...funcs: StoreEnhancer[]) => {
return (...args) => { return (...args: any[]) => {
const instanceId = generateId(config.instanceId); const instanceId = generateId(config.instanceId);
return [preEnhancer(instanceId), ...funcs].reduceRight( return [preEnhancer(instanceId), ...funcs].reduceRight(
(composed, f) => f(composed), (composed, f) => f(composed),
__REDUX_DEVTOOLS_EXTENSION__({ ...config, instanceId })(...args) (__REDUX_DEVTOOLS_EXTENSION__({ ...config, instanceId }) as any)(
...args
)
); );
}; };
}; };
@ -638,7 +670,7 @@ declare global {
} }
} }
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ = (...funcs) => { window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ = (...funcs: any[]) => {
if (funcs.length === 0) { if (funcs.length === 0) {
return __REDUX_DEVTOOLS_EXTENSION__(); return __REDUX_DEVTOOLS_EXTENSION__();
} }

View File

@ -14,8 +14,9 @@ chrome.storage.local.get(
's:secure': null, 's:secure': null,
}, },
(options) => { (options) => {
const AppAsAny = App as any;
render( render(
<App <AppAsAny
selectMonitor={options['select-monitor']} selectMonitor={options['select-monitor']}
testTemplates={options['test-templates']} testTemplates={options['test-templates']}
selectedTemplate={options['test-templates-sel']} selectedTemplate={options['test-templates-sel']}

View File

@ -382,7 +382,7 @@ export interface LibConfig {
export interface RequestBase { export interface RequestBase {
id?: string; id?: string;
instanceId?: string; instanceId?: string | number;
action?: string; action?: string;
name?: string | undefined; name?: string | undefined;
libConfig?: LibConfig; libConfig?: LibConfig;
@ -441,7 +441,7 @@ export interface SetStateAction {
export interface RemoveInstanceAction { export interface RemoveInstanceAction {
type: typeof REMOVE_INSTANCE; type: typeof REMOVE_INSTANCE;
id: string; id: string | number;
} }
export interface ConnectRequestAction { export interface ConnectRequestAction {
@ -557,7 +557,6 @@ export type StoreActionWithoutUpdateStateOrLiftedAction =
| ChangeSectionAction | ChangeSectionAction
| ChangeThemeAction | ChangeThemeAction
| MonitorActionAction | MonitorActionAction
| LiftedActionAction
| SelectInstanceAction | SelectInstanceAction
| SelectMonitorAction | SelectMonitorAction
| UpdateMonitorStateAction | UpdateMonitorStateAction

View File

@ -231,7 +231,7 @@ export function dispatchAction(
return state; return state;
} }
function removeState(state: InstancesState, connectionId: string) { function removeState(state: InstancesState, connectionId: string | number) {
const instanceIds = state.connections[connectionId]; const instanceIds = state.connections[connectionId];
if (!instanceIds) return state; if (!instanceIds) return state;

View File

@ -18,7 +18,7 @@ export interface MonitorStateMonitorState {
} }
export interface MonitorState { export interface MonitorState {
selected: string; selected: string;
monitorState: MonitorStateMonitorState | undefined; monitorState?: MonitorStateMonitorState | undefined;
sliderIsOpen: boolean; sliderIsOpen: boolean;
dispatcherIsOpen: boolean; dispatcherIsOpen: boolean;
} }

View File

@ -4,7 +4,7 @@ import stringifyJSON from './stringifyJSON';
import { SET_STATE } from '../constants/actionTypes'; import { SET_STATE } from '../constants/actionTypes';
import { InstancesState, State } from '../reducers/instances'; import { InstancesState, State } from '../reducers/instances';
import { Dispatch, MiddlewareAPI } from 'redux'; import { Dispatch, MiddlewareAPI } from 'redux';
import { DispatchAction, StoreAction } from '../actions'; import { DispatchAction, StoreActionWithoutLiftedAction } from '../actions';
export function sweep(state: State): State { export function sweep(state: State): State {
return { return {
@ -21,7 +21,7 @@ export function sweep(state: State): State {
export function nonReduxDispatch( export function nonReduxDispatch(
store: MiddlewareAPI< store: MiddlewareAPI<
Dispatch<StoreAction>, Dispatch<StoreActionWithoutLiftedAction>,
{ readonly instances: InstancesState } { readonly instances: InstancesState }
>, >,
message: string, message: string,