redux-paginator-immutable 17.0.39 → 17.0.41

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/lib/Info.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare type InfoPropTypes = {
2
+ type InfoPropTypes = {
3
3
  shown: number;
4
4
  total: number;
5
5
  one: string;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- declare type LoadDataItemPropTypes = {
2
+ type LoadDataItemPropTypes = {
3
3
  isFetching: boolean;
4
4
  fetched: boolean;
5
5
  id: string;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare type Settings = {
2
+ type Settings = {
3
3
  key: string;
4
4
  rowsPerLoad: number;
5
5
  manipulateItems: (items: any) => any;
@@ -7,18 +7,18 @@ declare type Settings = {
7
7
  changeView: (data: any) => any;
8
8
  requestPage: (page: number, token: string) => any;
9
9
  };
10
- export declare type LoadPaginatorPropTypes = {
10
+ export type LoadPaginatorPropTypes = {
11
11
  token: string;
12
12
  settings: Settings;
13
13
  children: JSX.Element;
14
14
  };
15
- export declare type ChangeView = (info: {
15
+ export type ChangeView = (info: {
16
16
  token: string;
17
17
  view: number;
18
18
  }) => any;
19
- export declare type ResetView = (token: string) => any;
20
- export declare type LoadData = (page: number) => any;
21
- export declare type List = {
19
+ export type ResetView = (token: string) => any;
20
+ export type LoadData = (page: number) => any;
21
+ export type List = {
22
22
  token: string;
23
23
  settings: Settings;
24
24
  paginator: any;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare type LoadingButtonPropTypes = {
2
+ type LoadingButtonPropTypes = {
3
3
  isFetching: boolean;
4
4
  hasProblems: boolean;
5
5
  onLoadMoreClick: () => void;
@@ -5,12 +5,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const react_1 = __importDefault(require("react"));
7
7
  const Messages_1 = require("x25/Messages");
8
+ const react_intersection_observer_1 = require("react-intersection-observer");
8
9
  const utility_1 = require("x25/utility");
9
10
  const LoadingButton = (props) => {
10
- const { isFetching, hasProblems, onLoadMoreClick } = props;
11
+ const { isFetching, hasProblems, onLoadMoreClick } = props, [ref, inView] = (0, react_intersection_observer_1.useInView)({
12
+ // /* Optional options */
13
+ // triggerOnce: true,
14
+ // rootMargin: '0px 0px',
15
+ });
16
+ react_1.default.useEffect(() => {
17
+ if (!isFetching && !hasProblems && inView) {
18
+ onLoadMoreClick();
19
+ }
20
+ }, [isFetching, hasProblems, inView]);
11
21
  return (react_1.default.createElement("div", { className: "text-center my-2" },
12
22
  hasProblems ? react_1.default.createElement(Messages_1.ErrorMessage, { message: utility_1.words.ThereWasAProblem }) : null,
13
- isFetching ? react_1.default.createElement(Messages_1.LoadingMessage, { message: utility_1.words.LoadingData, sm: true }) : (react_1.default.createElement("button", { className: "btn btn-outline-info d-print-none", disabled: isFetching, onClick: onLoadMoreClick, type: "button" }, isFetching ? utility_1.words.LoadingData : utility_1.words.LoadMore))));
23
+ isFetching ? react_1.default.createElement(Messages_1.LoadingMessage, { message: utility_1.words.LoadingData, sm: true }) : (react_1.default.createElement("button", { className: "btn btn-outline-info d-print-none", disabled: isFetching, onClick: onLoadMoreClick, ref: ref, type: "button" }, isFetching ? utility_1.words.LoadingData : utility_1.words.LoadMore))));
14
24
  };
15
25
  exports.default = LoadingButton;
16
26
  //# sourceMappingURL=LoadingButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LoadingButton.js","sourceRoot":"","sources":["../src/LoadingButton.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,2CAA4D;AAO5D,yCAAoC;AAEpC,MAAM,aAAa,GAAG,CAAC,KAA8B,EAAE,EAAE;IACvD,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;IAE3D,OAAO,CACL,uCAAK,SAAS,EAAC,kBAAkB;QAC9B,WAAW,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,UAAU,CAAC,CAAC,CAAC,8BAAC,yBAAc,IAAC,OAAO,EAAE,eAAK,CAAC,WAAW,EAAE,EAAE,SAAG,CAAC,CAAC,CAAC,CAChE,0CACE,SAAS,EAAC,mCAAmC,EAC7C,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,eAAe,EACxB,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,QAAQ,IACZ,UAAU,CAAC,CAAC,CAAC,eAAK,CAAC,WAAW,CAAC,CAAC,CAAC,eAAK,CAAC,QAAQ,CACzC,CACV,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,aAAa,CAAC"}
package/lib/actions.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Action, EndPointCb } from "./types";
2
- declare type RequestPageArgsTypes = {
2
+ type RequestPageArgsTypes = {
3
3
  endpoint: string;
4
4
  endpointCb: EndPointCb;
5
5
  manageEntity: any;
@@ -10,7 +10,7 @@ declare type RequestPageArgsTypes = {
10
10
  page: number;
11
11
  token: string;
12
12
  };
13
- declare type ReceivePageArgsTypes = {
13
+ type ReceivePageArgsTypes = {
14
14
  endpoint: string;
15
15
  endpointCb: EndPointCb;
16
16
  manageEntity: any;
@@ -22,7 +22,7 @@ declare type ReceivePageArgsTypes = {
22
22
  total: number;
23
23
  error: boolean;
24
24
  };
25
- declare type FetchDataItem = {
25
+ type FetchDataItem = {
26
26
  dataItemURL: string;
27
27
  endpoint: string;
28
28
  normalizeDataItem: any;
package/lib/agent.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- declare type FetchPageArgs = {
1
+ type FetchPageArgs = {
2
2
  endpoint: string;
3
3
  pageArgName: string;
4
4
  page: number;
@@ -1,6 +1,6 @@
1
1
  import type { PaginatorSettings } from "./types";
2
- declare type Selector = (state: any, id: string) => any;
3
- declare type ListSelector = (state: any) => any;
2
+ type Selector = (state: any, id: string) => any;
3
+ type ListSelector = (state: any) => any;
4
4
  declare const createDataReducer: ({ key }: PaginatorSettings) => {
5
5
  getItems: (state: any) => any;
6
6
  getItem: Selector;
@@ -2,7 +2,7 @@ import type { PaginatorSettings } from "./types";
2
2
  declare const createReducer: ({ key }: PaginatorSettings) => {
3
3
  getItems: (state: any) => any;
4
4
  getItem: (state: any, id: string) => any;
5
- getItemsList: ((state: {}) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
5
+ getItemsList: ((state: any) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
6
6
  clearCache: () => void;
7
7
  };
8
8
  };
@@ -1,11 +1,11 @@
1
1
  import type { PaginatorSettings } from "./types";
2
- declare type EndpointData = {
2
+ type EndpointData = {
3
3
  path: string;
4
4
  cb: () => string;
5
5
  };
6
- declare type Endpoint = EndpointData | string;
7
- declare type CreatePaginator = (endpoint: Endpoint, info: PaginatorSettings) => any;
8
- declare type OnlyForEndpoint = (endpoint: string, reducer: any) => (state: any, action: {
6
+ type Endpoint = EndpointData | string;
7
+ type CreatePaginator = (endpoint: Endpoint, info: PaginatorSettings) => any;
8
+ type OnlyForEndpoint = (endpoint: string, reducer: any) => (state: any, action: {
9
9
  meta: {
10
10
  endpoint: string;
11
11
  };
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable max-lines-per-function, */
3
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
3
  if (k2 === undefined) k2 = k;
5
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -1 +1 @@
1
- {"version":3,"file":"createPaginator.js","sourceRoot":"","sources":["../src/createPaginator.ts"],"names":[],"mappings":";AAAA,6CAA6C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7C,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,qDAAuC;AACvC,yCAAyG;AACzG,wDAAgC;AAkBhC,MAAM,WAAW,GAAG,CAAC,IAAc,EAAE,EAAE;IACrC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO;YACL,IAAI,EAAG,I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YAAY,EAAO,IAAA,uBAAe,EAAC,QAAQ,EAAE,gBAAY,CAAC,EAC1D,YAAY,EAAO,IAAA,uBAAe,EAAC,QAAQ,EAAE,gBAAY,CAAC,EAC1D,gBAAgB,EAAG,IAAA,uBAAe,EAAC,QAAQ,EAAE,oBAAgB,CAAC,IAC3D,iBAAiB,EACpB;AACJ,CAAC,CAAC;AApEF,QAAA,eAAe,oBAOf,QAAA,eAAe,mBA6Db"}
@@ -1,4 +1,4 @@
1
- declare type FetchItemDataFulFilledProps = {
1
+ type FetchItemDataFulFilledProps = {
2
2
  payload: {
3
3
  Data: any;
4
4
  };
@@ -1,49 +1,29 @@
1
+ import type { State } from "./types";
1
2
  declare const _default: {
2
- getAllResults: ((state: {
3
- readonly pages: any;
4
- readonly itemsReducer: any;
5
- }, params_0: string, params_1: {}) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any) => any> & {
3
+ getAllResults: ((state: State, _token: string, items: any) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any) => any> & {
6
4
  clearCache: () => void;
7
5
  };
8
- getCurrentTotalResultsCount: ((state: {
9
- readonly pages: any;
10
- readonly itemsReducer: any;
11
- }, params_0: string) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
6
+ getCurrentTotalResultsCount: ((state: State, token: string) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
12
7
  clearCache: () => void;
13
8
  };
14
- getResultsUpToPage: ((state: {
15
- readonly pages: any;
16
- readonly itemsReducer: any;
17
- }, params_0: string, params_1: {}, params_2: {}, params_3: number) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any, args_2: any, args_3: number) => any> & {
9
+ getResultsUpToPage: ((state: State, _token: string, _items: any, _target: any, perPage: number) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any, args_2: any, args_3: number) => any> & {
18
10
  clearCache: () => void;
19
11
  };
20
- isPageFetching: ((state: {
21
- readonly pages: any;
22
- readonly itemsReducer: any;
23
- }, params_0: string, params_1: {}) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any) => any> & {
12
+ isPageFetching: ((state: State, _token: string, target: any) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any) => any> & {
24
13
  clearCache: () => void;
25
14
  };
26
- isPageFetched: ((state: {
27
- readonly pages: any;
28
- readonly itemsReducer: any;
29
- }, params_0: string, params_1: {}) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any) => any> & {
15
+ isPageFetched: ((state: State, _token: string, target: any) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any) => any> & {
30
16
  clearCache: () => void;
31
17
  };
32
- hasPageProblems: ((state: {
33
- readonly pages: any;
34
- readonly itemsReducer: any;
35
- }, params_0: string) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
18
+ hasPageProblems: ((state: State, token: string) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
36
19
  clearCache: () => void;
37
20
  };
38
- getCurrentView: ((state: {
39
- readonly pages: any;
40
- readonly itemsReducer: any;
41
- }, params_0: string) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
21
+ getCurrentView: ((state: State, token: string) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
42
22
  clearCache: () => void;
43
23
  };
44
24
  getPaginatorPaginations: (state: any, name: string) => any;
45
25
  getPaginatorEntities: (state: any, name: string) => any;
46
- getPaginators: ((state: {}, params_0: string) => {
26
+ getPaginators: ((state: any, name: string) => {
47
27
  list: any;
48
28
  entities: any;
49
29
  }) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any) => {
@@ -1,5 +1,5 @@
1
1
  import type { EndPointCb } from "./index";
2
- export declare type RequestPageAction = {
2
+ export type RequestPageAction = {
3
3
  type: "@@redux-paginator-immutable/REQUEST_PAGE";
4
4
  meta: {
5
5
  endpoint: string;
@@ -15,7 +15,7 @@ export declare type RequestPageAction = {
15
15
  token: string;
16
16
  };
17
17
  };
18
- export declare type ReceivePageAction = {
18
+ export type ReceivePageAction = {
19
19
  type: "@@redux-paginator-immutable/RECEIVE_PAGE";
20
20
  meta: {
21
21
  endpoint: string;
@@ -33,7 +33,7 @@ export declare type ReceivePageAction = {
33
33
  raw?: string;
34
34
  };
35
35
  };
36
- export declare type ChangeViewAction = {
36
+ export type ChangeViewAction = {
37
37
  type: "@@redux-paginator-immutable/CHANGE_VIEW";
38
38
  meta: {
39
39
  endpoint: string;
@@ -43,7 +43,7 @@ export declare type ChangeViewAction = {
43
43
  token: string;
44
44
  };
45
45
  };
46
- export declare type ResetViewAction = {
46
+ export type ResetViewAction = {
47
47
  type: "@@redux-paginator-immutable/RESET_VIEW";
48
48
  meta: {
49
49
  endpoint: string;
@@ -52,28 +52,28 @@ export declare type ResetViewAction = {
52
52
  token: string;
53
53
  };
54
54
  };
55
- export declare type ClearDataAction = {
55
+ export type ClearDataAction = {
56
56
  type: "@@redux-paginator-immutable/CLEAR_DATA";
57
57
  meta: {
58
58
  endpoint: string;
59
59
  };
60
60
  };
61
- export declare type FetchCurrentCompanyInfoPending = {
61
+ export type FetchCurrentCompanyInfoPending = {
62
62
  type: "FETCH_CURRENT_COMPANY_INFO_PENDING";
63
63
  };
64
- export declare type FetchItemDataPending = {
64
+ export type FetchItemDataPending = {
65
65
  type: "@@redux-paginator-immutable/FETCH_ITEM_DATA_PENDING";
66
66
  meta: {
67
67
  id: string;
68
68
  };
69
69
  };
70
- export declare type FetchItemDataRejected = {
70
+ export type FetchItemDataRejected = {
71
71
  type: "@@redux-paginator-immutable/FETCH_ITEM_DATA_REJECTED";
72
72
  meta: {
73
73
  id: string;
74
74
  };
75
75
  };
76
- export declare type FetchItemDataFulFilled = {
76
+ export type FetchItemDataFulFilled = {
77
77
  type: "@@redux-paginator-immutable/FETCH_ITEM_DATA_FULFILLED";
78
78
  payload: {
79
79
  Data: any;
@@ -82,4 +82,4 @@ export declare type FetchItemDataFulFilled = {
82
82
  id: string;
83
83
  };
84
84
  };
85
- export declare type Action = RequestPageAction | ReceivePageAction | ResetViewAction | ChangeViewAction | ClearDataAction | FetchCurrentCompanyInfoPending | FetchItemDataPending | FetchItemDataRejected | FetchItemDataFulFilled;
85
+ export type Action = RequestPageAction | ReceivePageAction | ResetViewAction | ChangeViewAction | ClearDataAction | FetchCurrentCompanyInfoPending | FetchItemDataPending | FetchItemDataRejected | FetchItemDataFulFilled;
@@ -2,12 +2,12 @@ export * from "./actions";
2
2
  export * from "./state";
3
3
  import type { State } from "./state";
4
4
  import type { Action } from "./actions";
5
- export declare type GetState = () => State;
6
- export declare type PromiseAction = Promise<Action>;
7
- export declare type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;
8
- export declare type Dispatch = (action: Action | ThunkAction | PromiseAction | Array<Action>) => any;
9
- export declare type EndPointCb = ((token?: string) => string) | null;
10
- export declare type PaginatorSettings = {
5
+ export type GetState = () => State;
6
+ export type PromiseAction = Promise<Action>;
7
+ export type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;
8
+ export type Dispatch = (action: Action | ThunkAction | PromiseAction | Array<Action>) => any;
9
+ export type EndPointCb = ((token?: string) => string) | null;
10
+ export type PaginatorSettings = {
11
11
  key: string;
12
12
  manageEntity: any;
13
13
  resultsKey: string;
@@ -1,6 +1,6 @@
1
- export declare type PagesState = any;
2
- export declare type ItemsState = any;
3
- export declare type State = {
1
+ export type PagesState = any;
2
+ export type ItemsState = any;
3
+ export type State = {
4
4
  readonly pages: PagesState;
5
5
  readonly itemsReducer: ItemsState;
6
6
  };
package/lib/util.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- declare type NormalizrEntity = (data: any) => any;
1
+ type NormalizrEntity = (data: any) => any;
2
2
  import type { Map as ImmutableMap } from "immutable";
3
- declare type ManageDataEntity = ImmutableMap<string, any>;
4
- declare const manageEntity: (normalizrEntity: NormalizrEntity) => (item: any, state: any, keyID: string) => ManageDataEntity, manipulateItems: (sortKey?: string) => ((state: {}) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
3
+ type ManageDataEntity = ImmutableMap<string, any>;
4
+ declare const manageEntity: (normalizrEntity: NormalizrEntity) => (item: any, state: any, keyID: string) => ManageDataEntity, manipulateItems: (sortKey?: string) => ((state: any) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
5
5
  clearCache: () => void;
6
- }, manageDataEntity: (normalizrEntity: NormalizrEntity) => (item: any, state: any, keyID: string) => ManageDataEntity, manipulateDataItems: (sortKey?: string) => ((state: {}) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
6
+ }, manageDataEntity: (normalizrEntity: NormalizrEntity) => (item: any, state: any, keyID: string) => ManageDataEntity, manipulateDataItems: (sortKey?: string) => ((state: any) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
7
7
  clearCache: () => void;
8
8
  };
9
9
  export { manageDataEntity, manipulateDataItems, manipulateItems, manageEntity };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redux-paginator-immutable",
3
- "version": "17.0.39",
3
+ "version": "17.0.41",
4
4
  "types": "./lib/index.d.ts",
5
5
  "description": "redux-paginator-immutable helps you deal with paginated API by composing your existing reducers",
6
6
  "main": "./lib/index.js",
@@ -76,21 +76,21 @@
76
76
  },
77
77
  "homepage": "https://github.com/cristian-sima/redux-paginator-immutable#readme",
78
78
  "devDependencies": {
79
- "@babel/preset-env": "^7.19.4",
79
+ "@babel/preset-env": "^7.20.2",
80
80
  "@babel/preset-typescript": "^7.18.6",
81
- "@types/superagent": "^4.1.15",
82
- "@typescript-eslint/eslint-plugin": "^5.41.0",
83
- "@typescript-eslint/parser": "^5.41.0",
81
+ "@types/superagent": "^4.1.16",
82
+ "@typescript-eslint/eslint-plugin": "^5.48.0",
83
+ "@typescript-eslint/parser": "^5.48.0",
84
84
  "babel-plugin-transform-decorators-legacy": "^1.3.5",
85
85
  "babel-polyfill": "^6.26.0",
86
- "chai": "^4.3.4",
86
+ "chai": "^4.3.7",
87
87
  "chai-immutable": "^2.1.0",
88
88
  "codecov": "^3.8.1",
89
89
  "depcheck": "^1.4.3",
90
90
  "es3ify": "^0.2.2",
91
- "eslint": "^8.26.0",
91
+ "eslint": "^8.31.0",
92
92
  "eslint-plugin-import": "^2.26.0",
93
- "eslint-plugin-react": "^7.31.10",
93
+ "eslint-plugin-react": "^7.31.11",
94
94
  "expect": "^28.1.0",
95
95
  "flux-standard-action": "^2.1.1",
96
96
  "glob": "^8.0.3",
@@ -99,17 +99,18 @@
99
99
  "npm-check": "^5.9.2",
100
100
  "rimraf": "^3.0.2",
101
101
  "ts-mocha": "^10.0.0",
102
- "typescript": "^4.6.4",
103
- "webpack": "^5.74.0"
102
+ "typescript": "^4.9.4",
103
+ "webpack": "^5.75.0"
104
104
  },
105
105
  "dependencies": {
106
106
  "immutable": "^3.8.2",
107
107
  "query-string": "^7.1.1",
108
108
  "react": "^17.0.2",
109
- "react-redux": "^8.0.4",
109
+ "react-intersection-observer": "^9.4.1",
110
+ "react-redux": "^8.0.5",
110
111
  "redux": "^4.2.0",
111
- "reselect": "^4.1.6",
112
+ "reselect": "^4.1.7",
112
113
  "superagent": "^7.1.3",
113
- "x25": "^17.3.2"
114
+ "x25": "^17.3.13"
114
115
  }
115
116
  }
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { ErrorMessage, LoadingMessage } from "x25/Messages";
3
+ import { useInView } from "react-intersection-observer";
3
4
 
4
5
  type LoadingButtonPropTypes = {
5
6
  isFetching: boolean;
@@ -9,7 +10,19 @@ type LoadingButtonPropTypes = {
9
10
  import { words } from "x25/utility";
10
11
 
11
12
  const LoadingButton = (props : LoadingButtonPropTypes) => {
12
- const { isFetching, hasProblems, onLoadMoreClick } = props;
13
+ const
14
+ { isFetching, hasProblems, onLoadMoreClick } = props,
15
+ [ref, inView] = useInView({
16
+ // /* Optional options */
17
+ // triggerOnce: true,
18
+ // rootMargin: '0px 0px',
19
+ });
20
+
21
+ React.useEffect(() => {
22
+ if (!isFetching && !hasProblems && inView) {
23
+ onLoadMoreClick();
24
+ }
25
+ }, [isFetching, hasProblems, inView]);
13
26
 
14
27
  return (
15
28
  <div className="text-center my-2">
@@ -19,6 +32,7 @@ const LoadingButton = (props : LoadingButtonPropTypes) => {
19
32
  className="btn btn-outline-info d-print-none"
20
33
  disabled={isFetching}
21
34
  onClick={onLoadMoreClick}
35
+ ref={ref}
22
36
  type="button">
23
37
  {isFetching ? words.LoadingData : words.LoadMore}
24
38
  </button>
@@ -1,5 +1,3 @@
1
- /* eslint-disable max-lines-per-function, */
2
-
3
1
  const defaultRowsPerLoad = 25;
4
2
 
5
3
  import * as Immutable from "immutable";