@cccsaurora/howler-ui 2.19.0-cases.1154 → 2.19.0-cases.1192

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.
@@ -4,11 +4,11 @@ import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
4
4
  import useMyLocalStorage, { useMyLocalStorageItem } from '@cccsaurora/howler-ui/components/hooks/useMyLocalStorage';
5
5
  import dayjs from 'dayjs';
6
6
  import i18n from '@cccsaurora/howler-ui/i18n';
7
- import { cloneDeep } from 'lodash-es';
7
+ import { cloneDeep, isNil } from 'lodash-es';
8
8
  import isNull from 'lodash-es/isNull';
9
9
  import isUndefined from 'lodash-es/isUndefined';
10
10
  import { useCallback, useEffect, useMemo, useState } from 'react';
11
- import { useLocation, useParams } from 'react-router-dom';
11
+ import { useLocation } from 'react-router-dom';
12
12
  import { createContext, useContextSelector } from 'use-context-selector';
13
13
  import { DEFAULT_QUERY, StorageKey } from '@cccsaurora/howler-ui/utils/constants';
14
14
  import Throttler from '@cccsaurora/howler-ui/utils/Throttler';
@@ -20,7 +20,6 @@ export const RecordSearchContext = createContext(null);
20
20
  const THROTTLER = new Throttler(500);
21
21
  const RecordSearchProvider = ({ children }) => {
22
22
  const { get } = useMyLocalStorage();
23
- const routeParams = useParams();
24
23
  const location = useLocation();
25
24
  const { dispatchApi } = useMyApi();
26
25
  const pageCount = useMyLocalStorageItem(StorageKey.PAGE_COUNT, 25)[0];
@@ -101,7 +100,7 @@ const RecordSearchProvider = ({ children }) => {
101
100
  setError(null);
102
101
  try {
103
102
  const _response = await dispatchApi(api.v2.search.post(indexes, {
104
- offset: appendResults && response ? response.rows : offset,
103
+ offset: appendResults && !isNil(response?.rows) ? response.rows : offset,
105
104
  rows: pageCount,
106
105
  query: _query || DEFAULT_QUERY,
107
106
  sort,
@@ -134,29 +133,22 @@ const RecordSearchProvider = ({ children }) => {
134
133
  setSearching(false);
135
134
  }
136
135
  });
137
- },
138
- // We skip reloading when the response changes
139
- // eslint-disable-next-line react-hooks/exhaustive-deps
140
- [
136
+ }, [
141
137
  sort,
142
138
  span,
143
139
  query,
144
- startDate,
145
- endDate,
146
- filters,
147
140
  indexes,
148
141
  setQuery,
149
- location.pathname,
150
- routeParams.id,
151
- views,
152
- dispatchApi,
142
+ setQueryHistory,
143
+ queryHistory,
144
+ response?.rows,
153
145
  offset,
146
+ dispatchApi,
154
147
  pageCount,
148
+ getFilters,
155
149
  trackTotalHits,
156
150
  loadHits,
157
- getCurrentViews,
158
- setOffset,
159
- getFilters
151
+ setOffset
160
152
  ]);
161
153
  // We only run this when ancillary properties (i.e. filters, sorting) change
162
154
  useEffect(() => {
package/package.json CHANGED
@@ -93,7 +93,7 @@
93
93
  "url": "https://github.com/CybercentreCanada/howler"
94
94
  },
95
95
  "type": "module",
96
- "version": "2.19.0-cases.1154",
96
+ "version": "2.19.0-cases.1192",
97
97
  "exports": {
98
98
  "./i18n": "./i18n.js",
99
99
  "./index.css": "./index.css",