@opengeoweb/workspace 9.4.1 → 9.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -4,7 +4,7 @@ import { syncGroupsTypes, syncGroupsActions, layerActions, mapStoreActions, uiAc
4
4
  import { createApiInstance, createNonAuthApiInstance, getApi, createFakeApiInstance, ApiProvider, useApiContext } from '@opengeoweb/api';
5
5
  import { getLeaves, MosaicContext, getAndAssertNodeAtPathExists, createBalancedTreeFromLeaves, MosaicWindow, Mosaic } from 'react-mosaic-component';
6
6
  import { debounce, takeEvery, takeLatest, all, put, delay, call, select, takeLeading } from 'redux-saga/effects';
7
- import { isAxiosError, getAxiosErrorMessage, withEggs, ConfirmationServiceProvider, useConfirmationDialog, CustomIconButton, AlertBanner, CustomTooltip, SearchHighlight, ToggleMenu, getHeight, usePrevious, ToolContainer, CustomToggleButton, ConfirmationDialog } from '@opengeoweb/shared';
7
+ import { isAxiosError, getAxiosErrorMessage, withEggs, ConfirmationServiceProvider, useConfirmationDialog, CustomIconButton, AlertBanner, CustomTooltip, SearchHighlight, ToggleMenu, getHeight, usePrevious, renderCounter, ToolContainer, CustomToggleButton, ConfirmationDialog } from '@opengeoweb/shared';
8
8
  import { snackbarActions, SnackbarWrapperConnect } from '@opengeoweb/snackbar';
9
9
  import * as React from 'react';
10
10
  import React__default, { useCallback } from 'react';
@@ -6204,6 +6204,7 @@ var ViewPresetMenu = function ViewPresetMenu(_ref) {
6204
6204
  }, /*#__PURE__*/React__default.createElement(ViewPresetMenuListConnect, {
6205
6205
  panelId: panelId
6206
6206
  }));
6207
+ renderCounter.count(ViewPresetMenu.name);
6207
6208
  return /*#__PURE__*/React__default.createElement("div", null, hideBackdrop ?
6208
6209
  // Enable hiding backdrop from snapshot tests
6209
6210
  toolContainer : ( /*#__PURE__*/React__default.createElement(Backdrop, {
@@ -6482,6 +6483,15 @@ var WorkspaceViewTitleConnect = function WorkspaceViewTitleConnect(_ref) {
6482
6483
  var title = (workspaceView === null || workspaceView === void 0 ? void 0 : workspaceView.title) || MAPPRESET_ACTIVE_TITLE;
6483
6484
  var viewScope = workspaceView === null || workspaceView === void 0 ? void 0 : workspaceView.scope;
6484
6485
  var fullTitle = getPresetTitle(title, hasMapPresetChanges, isNewActive);
6486
+ // TODO: https://gitlab.com/opengeoweb/opengeoweb/-/issues/4546
6487
+ // This component renders on every change in the mapstate.
6488
+ // This is because selectors like mapSelectors.getMapPreset are used in the component.
6489
+ // The data from this selector is not used during a render, so it is wasting renders.
6490
+ // The data is need only in the callback functions - not the component itself
6491
+ // To prevent unneeded renders, this code should be rewritten by using refs, or move the logic to sagas.
6492
+ // You can use the renderCounter to check the nubmer of renders.
6493
+ // Also check https://xam-react-coe.medium.com/react-useselector-without-re-render-225686bee3f
6494
+ renderCounter.count(WorkspaceViewTitleConnect.name);
6485
6495
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CustomIconButton, {
6486
6496
  "data-testid": "open-viewpresets",
6487
6497
  sx: {
@@ -7204,8 +7214,7 @@ var WorkspaceMenuButton = function WorkspaceMenuButton(_ref) {
7204
7214
  * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
7205
7215
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
7206
7216
  * */
7207
- var WorkspaceMenuButtonConnect = function WorkspaceMenuButtonConnect(_ref) {
7208
- var workspaceId = _ref.workspaceId;
7217
+ var WorkspaceMenuButtonConnect = function WorkspaceMenuButtonConnect() {
7209
7218
  var dispatch = useDispatch();
7210
7219
  var setListDialogOpen = React__default.useCallback(function (isListDialogOpen) {
7211
7220
  dispatch(workspaceListActions.toggleWorkspaceDialog({
@@ -7215,13 +7224,6 @@ var WorkspaceMenuButtonConnect = function WorkspaceMenuButtonConnect(_ref) {
7215
7224
  var isWorkspaceListDialogOpen = useSelector(function (store) {
7216
7225
  return getIsWorkspaceListDialogOpen(store);
7217
7226
  });
7218
- React__default.useEffect(function () {
7219
- // open workspaceDialog on mount if needed
7220
- if (workspaceId === undefined || workspaceId === 'emptyMap' || workspaceId === '') {
7221
- setListDialogOpen(true);
7222
- }
7223
- // eslint-disable-next-line react-hooks/exhaustive-deps
7224
- }, [setListDialogOpen]);
7225
7227
  return /*#__PURE__*/React__default.createElement(WorkspaceMenuButton, {
7226
7228
  showMenu: isWorkspaceListDialogOpen,
7227
7229
  onToggleDialog: setListDialogOpen
@@ -7353,9 +7355,7 @@ var WorkspaceTab = function WorkspaceTab(_ref) {
7353
7355
  alignItems: 'center'
7354
7356
  },
7355
7357
  "data-testid": "workspaceTab"
7356
- }, /*#__PURE__*/React.createElement(WorkspaceMenuButtonConnect, {
7357
- workspaceId: workspaceId
7358
- }), /*#__PURE__*/React.createElement(WorkspaceOptionsConnect, {
7358
+ }, /*#__PURE__*/React.createElement(WorkspaceMenuButtonConnect, null), /*#__PURE__*/React.createElement(WorkspaceOptionsConnect, {
7359
7359
  title: title,
7360
7360
  activeTab: activeTab,
7361
7361
  workspaceId: workspaceId
package/package.json CHANGED
@@ -1,12 +1,44 @@
1
1
  {
2
2
  "name": "@opengeoweb/workspace",
3
- "version": "9.4.1",
3
+ "version": "9.6.0",
4
4
  "description": "GeoWeb Workspace library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
+ "dependencies": {
11
+ "react-redux": "^8.1.3",
12
+ "@opengeoweb/shared": "*",
13
+ "@mui/material": "5.12.0",
14
+ "@opengeoweb/form-fields": "*",
15
+ "@opengeoweb/store": "*",
16
+ "@opengeoweb/api": "*",
17
+ "react-hook-form": "7.47.0",
18
+ "@opengeoweb/core": "*",
19
+ "@opengeoweb/theme": "*",
20
+ "@reduxjs/toolkit": "^1.9.7",
21
+ "@opengeoweb/timeseries": "*",
22
+ "@opengeoweb/authentication": "*",
23
+ "@opengeoweb/snackbar": "*",
24
+ "react-window": "^1.8.10",
25
+ "@mui/system": "^5.15.1",
26
+ "redux-saga": "^1.2.3",
27
+ "react-mosaic-component": "^6.1.0",
28
+ "lodash": "^4.17.21",
29
+ "@emotion/react": "^11.11.1",
30
+ "@redux-eggs/core": "^2.2.0",
31
+ "@redux-eggs/redux-toolkit": "^2.2.0",
32
+ "@redux-eggs/saga-extension": "^2.2.0",
33
+ "immer": "^9.0.21",
34
+ "axios": "1.5.0",
35
+ "@opengeoweb/taf": "*",
36
+ "@opengeoweb/sigmet-airmet": "*",
37
+ "@opengeoweb/warnings": "*"
38
+ },
39
+ "peerDependencies": {
40
+ "react": "18"
41
+ },
10
42
  "module": "./index.esm.js",
11
43
  "type": "module",
12
44
  "main": "./index.esm.js"
@@ -1,6 +1,2 @@
1
1
  import React from 'react';
2
- interface WorkspaceMenuButtonConnectProps {
3
- workspaceId: string;
4
- }
5
- export declare const WorkspaceMenuButtonConnect: React.FC<WorkspaceMenuButtonConnectProps>;
6
- export {};
2
+ export declare const WorkspaceMenuButtonConnect: React.FC;
@@ -142,9 +142,7 @@ export declare const getWorkspaceData: ((state: AppStore & import("@opengeoweb/s
142
142
  }> & {
143
143
  clearCache: () => void;
144
144
  };
145
- export declare const getViewPresetToSendToBackend: ((state: AppStore & import("@opengeoweb/store").CoreAppStore, viewId: string | (string & {
146
- sourceId: string;
147
- })) => {
145
+ export declare const getViewPresetToSendToBackend: ((state: any, viewId: any) => {
148
146
  id: string | undefined;
149
147
  scope: import("./types").PresetScope;
150
148
  title: string;
@@ -1,11 +1,18 @@
1
1
  import { Theme } from '@mui/material';
2
2
  import React from 'react';
3
+ interface WorkspaceAppProps {
4
+ isSnapshot?: boolean;
5
+ workspaceId?: string;
6
+ shouldShowListOnOpen?: boolean;
7
+ }
8
+ export declare const WorkspaceApp: ({ isSnapshot, workspaceId, shouldShowListOnOpen, }: WorkspaceAppProps) => React.ReactElement;
3
9
  interface StoryWrapperProps {
4
10
  theme?: Theme;
5
11
  isSnapshot?: boolean;
6
12
  createApi?: () => void;
7
13
  workspaceId?: string;
8
14
  isLoggedIn?: boolean;
15
+ shouldShowListOnOpen?: boolean;
9
16
  }
10
- export declare const StoryWrapper: ({ theme, isSnapshot, createApi, workspaceId, isLoggedIn, }: StoryWrapperProps) => React.ReactElement;
17
+ export declare const StoryWrapper: ({ theme, isSnapshot, createApi, workspaceId, isLoggedIn, shouldShowListOnOpen, }: StoryWrapperProps) => React.ReactElement;
11
18
  export {};