Skip to content

Commit

Permalink
Update package versions
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaslehnertum committed May 9, 2024
1 parent d530e83 commit 912e284
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 63 deletions.
79 changes: 41 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@
"react": "18.2.0",
"react-color": "2.19.3",
"react-dom": "18.2.0",
"react-redux": "8.1.3",
"react-redux": "9.1.2",
"react-tooltip": "4.5.1",
"redux": "4.2.1",
"redux": "5.0.1",
"redux-saga": "1.3.0",
"redux-thunk": "2.4.2",
"redux-thunk": "3.1.0",
"rxjs": "7.8.1",
"styled-components": "5.3.11",
"tslib": "2.6.2",
Expand Down
23 changes: 7 additions & 16 deletions src/main/components/store/model-store.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
import React, { Component, PropsWithChildren } from 'react';
import { Provider } from 'react-redux';
import {
applyMiddleware,
combineReducers,
compose,
createStore,
PreloadedState,
Reducer,
Store,
StoreEnhancer,
} from 'redux';
import { applyMiddleware, combineReducers, compose, createStore, Reducer, Store, StoreEnhancer } from 'redux';
import createSagaMiddleware, { SagaMiddleware } from 'redux-saga';
import thunk, { ThunkMiddleware } from 'redux-thunk';
import { thunk, ThunkMiddleware } from 'redux-thunk';
import { Actions } from '../../services/actions';
import { ILayer } from '../../services/layouter/layer';
import { LayouterRepository } from '../../services/layouter/layouter-repository';
Expand All @@ -34,18 +25,18 @@ import { UMLModel } from '../../typings';
import { merge } from './merge';

type OwnProps = PropsWithChildren<{
initialState?: PreloadedState<PartialModelState>;
initialState?: PartialModelState;
patcher?: Patcher<UMLModel>;
}>;

type Props = OwnProps & CanvasContext;

export const createReduxStore = (
initialState: PreloadedState<PartialModelState> = {},
initialState: PartialModelState = {},
layer: ILayer | null = null,
patcher?: Patcher<UMLModel>,
): Store<ModelState, Actions> => {
const baseReducer: Reducer<ModelState, Actions> = undoable(combineReducers<ModelState, Actions>(reducers));
const baseReducer: Reducer<ModelState, Actions> = undoable<ModelState, Actions>(combineReducers(reducers) as any);
const patchReducer =
patcher &&
createPatcherReducer<UMLModel, ModelState>(patcher, {
Expand All @@ -57,7 +48,7 @@ export const createReduxStore = (
const reducer: Reducer<ModelState, Actions> = (state, action) => {
const baseState = baseReducer(state, action);
if (patchReducer) {
return patchReducer(baseState, action);
return patchReducer(baseState, action as any);
} else {
return baseState;
}
Expand Down Expand Up @@ -93,7 +84,7 @@ export const createReduxStore = (
};

const getInitialState = (
initialState: PreloadedState<PartialModelState> = {},
initialState: PartialModelState = {},
layer: ILayer | null = null,
patcher?: Patcher<UMLModel>,
): { store: Store<ModelState, Actions> } => {
Expand Down
5 changes: 3 additions & 2 deletions src/main/services/patcher/patcher-reducer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Reducer } from 'redux';
import { Patcher } from './patcher';
import { PatcherActionTypes } from './patcher-types';
import { Patch, PatcherActionTypes } from './patcher-types';
import { SignedPatch } from './patch-verifier';

export type PatcherReducerOptions<T, U = T> = {
/**
Expand Down Expand Up @@ -53,7 +54,7 @@ export function createPatcherReducer<T, U = T>(
return (state, action) => {
const { type, payload } = action;
if (type === PatcherActionTypes.PATCH) {
const res = patcher.patch(payload, transformInverse(state as U));
const res = patcher.patch(payload as Patch | SignedPatch, transformInverse(state as U));

if (res.patched) {
return merge((state ?? {}) as U, transform(res.result));
Expand Down
4 changes: 2 additions & 2 deletions src/main/utils/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { PutEffect } from 'redux-saga/effects';
import { ThunkAction, ThunkDispatch } from 'redux-thunk';
import { ModelState } from '../../components/store/model-state';

export interface Action<T = any> extends ReduxAction<T> {
export interface Action<T extends string = string> extends ReduxAction<T> {
payload: object;
undoable: boolean;
}

export interface RedoableAction<T = any> extends Action<T> {
export interface RedoableAction<T extends string = string> extends Action<T> {
redoable: true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/utils/fx/assign.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DeepPartial } from 'redux';
import { DeepPartial } from '../../typings';

export const assign = <T extends { [key: string]: any }>(target: T, source?: DeepPartial<T>): T => {
for (const key in source) {
Expand All @@ -18,7 +18,7 @@ export const assign = <T extends { [key: string]: any }>(target: T, source?: Dee
if (target === undefined) {
target = {} as T;
}
target[key] = source[key] as T[Extract<keyof T, string>];
target[key] = source[key] as T[Extract<keyof DeepPartial<T>, string>];
}
}

Expand Down

0 comments on commit 912e284

Please sign in to comment.