Skip to content

Shadab skhan/legacypeerdependency #905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6,533 changes: 3,741 additions & 2,792 deletions react/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
"@storybook/addon-docs": "^6.4.19",
"@storybook/addon-essentials": "^6.4.19",
"@storybook/addon-links": "^6.4.19",
"@storybook/builder-webpack5": "^6.4.19",
"@storybook/manager-webpack5": "^6.4.19",
"@storybook/react": "^6.4.19",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^12.1.2",
Expand Down
12 changes: 7 additions & 5 deletions react/src/lib/components/DeckGLMap/DeckGLMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
getLayersWithDefaultProps,
} from "./layers/utils/layerTools";
import { colorTablesArray } from "@emerson-eps/color-tables/";
import { useDispatch } from "react-redux";

interface DeckGLMapProps {
id: string;
Expand Down Expand Up @@ -88,26 +89,27 @@ const DeckGLMap: React.FC<DeckGLMapProps> = ({

// create store once with layers data
const store = React.useMemo(() => {
if (layers == undefined) return;
//if (layers == undefined) return;

return createStore({
layers: getLayersWithDefaultProps(layers),
layers: getLayersWithDefaultProps(layers ?? []),
views: views,
});
}, []);

// update store if any of the layer prop is changed
const dispatch = useDispatch();
React.useEffect(() => {
if (store == undefined || layers == undefined) return;

const prev_layers_in_redux = store.getState()["spec"]["layers"];
const layers_store = applyPropsOnLayers(prev_layers_in_redux, layers);
const layers_default = getLayersWithDefaultProps(layers_store);
const spec = { layers: layers_default, views: views };
store.dispatch(setSpec(spec));
}, [layers]);
dispatch(setSpec(spec));
}, [layers, dispatch]);

if (store == undefined) return null;
//if (store == undefined) return null;
return (
<ReduxProvider store={store}>
<Map
Expand Down
4 changes: 2 additions & 2 deletions react/src/lib/components/DeckGLMap/test/TestWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createStore } from "../redux/store";
import { testState } from "../../DeckGLMap/test/testReduxState";

export const testStore = createStore(testState);
testStore.dispatch = jest.fn();
testStore.dispatch = jest.fn() as never;
export const Wrapper = ({
children,
}: {
Expand All @@ -14,7 +14,7 @@ export const Wrapper = ({
};

export const emptytestStore = createStore({});
emptytestStore.dispatch = jest.fn();
emptytestStore.dispatch = jest.fn() as never;
export const EmptyWrapper = ({
children,
}: {
Expand Down
3 changes: 1 addition & 2 deletions react/src/lib/components/GroupTree/test/TestWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import { testState } from "./testReduxState";
// eslint-disable-next-line @typescript-eslint/no-var-requires
const exampleData = require("../../../../demo/example-data/group-tree.json");
export const testStore = createReduxStore(testState);
// eslint-disable-next-line no-undef
testStore.dispatch = jest.fn();
testStore.dispatch = jest.fn() as never;

// eslint-disable-next-line react/prop-types
export const Wrapper = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import { testState } from "./testReduxState";
// eslint-disable-next-line @typescript-eslint/no-var-requires
const exampleData = require("../../../../demo/example-data/well-completions.json");
export const testStore = createReduxStore(testState);
// eslint-disable-next-line no-undef
testStore.dispatch = jest.fn();
testStore.dispatch = jest.fn() as never;

// eslint-disable-next-line react/prop-types
export const Wrapper = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface Props {
* callback with new scroll positions
*/
onScroll?: (x: number, y: number) => void;
children?: ReactNode;
}

class Scroller extends Component<Props> {
Expand Down