@jobber/hooks 2.17.1 → 2.17.2
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/dist/index.js +18 -34
- package/dist/useBool/index.js +1 -5
- package/dist/useBool/useBool.js +6 -9
- package/dist/useBool/useBool.test.js +9 -11
- package/dist/useBreakpoints/index.js +2 -20
- package/dist/useBreakpoints/mockViewportWidth/index.js +1 -17
- package/dist/useBreakpoints/mockViewportWidth/mockViewportWidth.js +2 -6
- package/dist/useBreakpoints/mockViewportWidth/mockViewportWidth.test.js +4 -6
- package/dist/useBreakpoints/useBreakpoints.js +9 -13
- package/dist/useBreakpoints/useBreakpoints.test.js +30 -35
- package/dist/useBreakpoints/useMediaQuery.js +5 -9
- package/dist/useCallbackRef/index.js +1 -5
- package/dist/useCallbackRef/useCallbackRef.js +5 -8
- package/dist/useCallbackRef/useCallbackRef.test.js +4 -6
- package/dist/useCollectionQuery/index.js +1 -5
- package/dist/useCollectionQuery/mdxUtils.js +8 -12
- package/dist/useCollectionQuery/test-utilities/index.js +3 -19
- package/dist/useCollectionQuery/test-utilities/mocks.js +19 -30
- package/dist/useCollectionQuery/test-utilities/queries.js +4 -7
- package/dist/useCollectionQuery/test-utilities/utils.js +1 -4
- package/dist/useCollectionQuery/uniqueEdges.js +2 -6
- package/dist/useCollectionQuery/uniqueNodes.js +1 -4
- package/dist/useCollectionQuery/useCollectionQuery.js +27 -34
- package/dist/useCollectionQuery/useCollectionQuery.test.js +126 -128
- package/dist/useDebounce/index.js +1 -5
- package/dist/useDebounce/useDebounce.js +8 -11
- package/dist/useDebounce/useDebounce.test.js +42 -70
- package/dist/useFocusTrap/index.js +1 -5
- package/dist/useFocusTrap/useFocusTrap.js +4 -7
- package/dist/useFocusTrap/useFocusTrap.test.js +26 -31
- package/dist/useFormState/index.js +1 -5
- package/dist/useFormState/useFormState.js +3 -6
- package/dist/useInView/index.js +1 -17
- package/dist/useInView/useInView.js +6 -9
- package/dist/useInView/useInView.test.js +12 -17
- package/dist/useIsMounted/index.js +1 -5
- package/dist/useIsMounted/useIsMounted.js +5 -8
- package/dist/useIsMounted/useIsMounted.test.js +4 -6
- package/dist/useLiveAnnounce/index.js +1 -5
- package/dist/useLiveAnnounce/useLiveAnnounce.js +4 -7
- package/dist/useLiveAnnounce/useLiveAnnounce.test.js +19 -24
- package/dist/useOnKeyDown/index.js +1 -5
- package/dist/useOnKeyDown/useOnKeyDown.js +3 -6
- package/dist/useOnKeyDown/useOnKeyDown.test.js +7 -12
- package/dist/useOnMount/index.js +1 -5
- package/dist/useOnMount/useOnMount.js +6 -10
- package/dist/useOnMount/useOnMount.test.js +4 -6
- package/dist/useRefocusOnActivator/index.js +1 -5
- package/dist/useRefocusOnActivator/useRefocusOnActivator.js +3 -6
- package/dist/useResizeObserver/index.js +1 -17
- package/dist/useResizeObserver/useResizeObserver.js +9 -16
- package/dist/useSafeLayoutEffect/index.js +1 -5
- package/dist/useSafeLayoutEffect/useSafeLayoutEffect.js +4 -7
- package/dist/useShowClear/index.js +1 -5
- package/dist/useShowClear/useShowClear.js +1 -4
- package/dist/useShowClear/useShowClear.test.js +6 -8
- package/dist/useStepper/index.js +1 -5
- package/dist/useStepper/useStepper.js +9 -15
- package/dist/useStepper/useStepper.test.js +15 -17
- package/dist/useWindowDimensions/index.js +1 -5
- package/dist/useWindowDimensions/useWIndowDimensions.test.js +6 -8
- package/dist/useWindowDimensions/useWindowDimensions.js +4 -7
- package/package.json +102 -5
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
exports.subscriptionQueryMock = exports.listQueryWithTotalCountResponseMock = exports.listQueryResponseMock = void 0;
|
|
7
|
-
exports.wrapper = wrapper;
|
|
8
|
-
exports.buildListRequestMock = buildListRequestMock;
|
|
9
|
-
exports.buildSubscriptionRequestMock = buildSubscriptionRequestMock;
|
|
10
|
-
exports.buildListRequestMockForNextPage = buildListRequestMockForNextPage;
|
|
11
|
-
exports.setListQueryMockHasNextPage = setListQueryMockHasNextPage;
|
|
12
|
-
const react_testing_1 = require("@apollo/react-testing");
|
|
13
|
-
const react_1 = __importDefault(require("react"));
|
|
14
|
-
const uuid_1 = require("uuid");
|
|
15
|
-
const queries_1 = require("./queries");
|
|
16
|
-
function wrapper(mocks) {
|
|
1
|
+
import { MockedProvider } from "@apollo/react-testing";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { v1 as uuidv1 } from "uuid";
|
|
4
|
+
import { SUBSCRIPTION_QUERY } from "./queries";
|
|
5
|
+
export function wrapper(mocks) {
|
|
17
6
|
function ApolloMockedProvider({ children, }) {
|
|
18
|
-
return (
|
|
7
|
+
return (React.createElement(MockedProvider, { addTypename: true, mocks: mocks }, children));
|
|
19
8
|
}
|
|
20
9
|
return ApolloMockedProvider;
|
|
21
10
|
}
|
|
22
11
|
let listQueryHasNextPage = true;
|
|
23
|
-
|
|
12
|
+
export const listQueryResponseMock = jest.fn(id => {
|
|
24
13
|
return {
|
|
25
14
|
data: {
|
|
26
15
|
conversation: {
|
|
@@ -32,14 +21,14 @@ exports.listQueryResponseMock = jest.fn(id => {
|
|
|
32
21
|
__typename: "SMSMessageEdge",
|
|
33
22
|
node: {
|
|
34
23
|
__typename: "SMSMessage",
|
|
35
|
-
id: id || (
|
|
24
|
+
id: id || uuidv1(),
|
|
36
25
|
},
|
|
37
26
|
},
|
|
38
27
|
],
|
|
39
28
|
nodes: [
|
|
40
29
|
{
|
|
41
30
|
__typename: "SMSMessage",
|
|
42
|
-
id: id || (
|
|
31
|
+
id: id || uuidv1(),
|
|
43
32
|
},
|
|
44
33
|
],
|
|
45
34
|
pageInfo: {
|
|
@@ -52,7 +41,7 @@ exports.listQueryResponseMock = jest.fn(id => {
|
|
|
52
41
|
},
|
|
53
42
|
};
|
|
54
43
|
});
|
|
55
|
-
|
|
44
|
+
export const listQueryWithTotalCountResponseMock = jest.fn(id => {
|
|
56
45
|
return {
|
|
57
46
|
data: {
|
|
58
47
|
conversation: {
|
|
@@ -64,14 +53,14 @@ exports.listQueryWithTotalCountResponseMock = jest.fn(id => {
|
|
|
64
53
|
__typename: "SMSMessageEdge",
|
|
65
54
|
node: {
|
|
66
55
|
__typename: "SMSMessage",
|
|
67
|
-
id: id || (
|
|
56
|
+
id: id || uuidv1(),
|
|
68
57
|
},
|
|
69
58
|
},
|
|
70
59
|
],
|
|
71
60
|
nodes: [
|
|
72
61
|
{
|
|
73
62
|
__typename: "SMSMessage",
|
|
74
|
-
id: id || (
|
|
63
|
+
id: id || uuidv1(),
|
|
75
64
|
},
|
|
76
65
|
],
|
|
77
66
|
pageInfo: {
|
|
@@ -85,7 +74,7 @@ exports.listQueryWithTotalCountResponseMock = jest.fn(id => {
|
|
|
85
74
|
},
|
|
86
75
|
};
|
|
87
76
|
});
|
|
88
|
-
|
|
77
|
+
export const subscriptionQueryMock = jest.fn(id => {
|
|
89
78
|
return {
|
|
90
79
|
data: {
|
|
91
80
|
conversationMessage: {
|
|
@@ -99,7 +88,7 @@ exports.subscriptionQueryMock = jest.fn(id => {
|
|
|
99
88
|
},
|
|
100
89
|
};
|
|
101
90
|
});
|
|
102
|
-
function buildListRequestMock(query, responseMock, id, searchTerm) {
|
|
91
|
+
export function buildListRequestMock(query, responseMock, id, searchTerm) {
|
|
103
92
|
return {
|
|
104
93
|
request: {
|
|
105
94
|
query: query,
|
|
@@ -108,16 +97,16 @@ function buildListRequestMock(query, responseMock, id, searchTerm) {
|
|
|
108
97
|
result: () => responseMock(id),
|
|
109
98
|
};
|
|
110
99
|
}
|
|
111
|
-
function buildSubscriptionRequestMock(id) {
|
|
100
|
+
export function buildSubscriptionRequestMock(id) {
|
|
112
101
|
return {
|
|
113
102
|
request: {
|
|
114
|
-
query:
|
|
103
|
+
query: SUBSCRIPTION_QUERY,
|
|
115
104
|
},
|
|
116
|
-
result: () =>
|
|
105
|
+
result: () => subscriptionQueryMock(id),
|
|
117
106
|
delay: 100,
|
|
118
107
|
};
|
|
119
108
|
}
|
|
120
|
-
function buildListRequestMockForNextPage(query, responseMock, id) {
|
|
109
|
+
export function buildListRequestMockForNextPage(query, responseMock, id) {
|
|
121
110
|
return {
|
|
122
111
|
request: {
|
|
123
112
|
query: query,
|
|
@@ -126,6 +115,6 @@ function buildListRequestMockForNextPage(query, responseMock, id) {
|
|
|
126
115
|
result: () => responseMock(id),
|
|
127
116
|
};
|
|
128
117
|
}
|
|
129
|
-
function setListQueryMockHasNextPage(hasNextPage) {
|
|
118
|
+
export function setListQueryMockHasNextPage(hasNextPage) {
|
|
130
119
|
listQueryHasNextPage = hasNextPage;
|
|
131
120
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.SUBSCRIPTION_QUERY = exports.LIST_QUERY_WITH_TOTAL_COUNT = exports.LIST_QUERY = void 0;
|
|
4
|
-
const client_1 = require("@apollo/client");
|
|
5
|
-
exports.LIST_QUERY = (0, client_1.gql) `
|
|
1
|
+
import { gql } from "@apollo/client";
|
|
2
|
+
export const LIST_QUERY = gql `
|
|
6
3
|
query ConversationMessages($cursor: string, $searchTerm: string) {
|
|
7
4
|
conversation(id: "MQ==") {
|
|
8
5
|
smsMessages(first: 1, after: $cursor, searchTerm: $searchTerm) {
|
|
@@ -24,7 +21,7 @@ exports.LIST_QUERY = (0, client_1.gql) `
|
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
23
|
`;
|
|
27
|
-
|
|
24
|
+
export const LIST_QUERY_WITH_TOTAL_COUNT = gql `
|
|
28
25
|
query ConversationMessages($cursor: string, $searchTerm: string) {
|
|
29
26
|
conversation(id: "MQ==") {
|
|
30
27
|
smsMessages(first: 1, after: $cursor, searchTerm: $searchTerm) {
|
|
@@ -47,7 +44,7 @@ exports.LIST_QUERY_WITH_TOTAL_COUNT = (0, client_1.gql) `
|
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
46
|
`;
|
|
50
|
-
|
|
47
|
+
export const SUBSCRIPTION_QUERY = gql `
|
|
51
48
|
subscription ConversationMessage($conversationId: EncodedId!) {
|
|
52
49
|
conversationMessage(conversationId: $conversationId) {
|
|
53
50
|
smsMessage {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,9 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
exports.wait = wait;
|
|
13
|
-
function wait() {
|
|
10
|
+
export function wait() {
|
|
14
11
|
return __awaiter(this, arguments, void 0, function* (milliseconds = 0) {
|
|
15
12
|
yield new Promise(resolve => setTimeout(resolve, milliseconds));
|
|
16
13
|
});
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createEdge = createEdge;
|
|
4
|
-
exports.uniqueEdges = uniqueEdges;
|
|
5
|
-
function createEdge(node) {
|
|
1
|
+
export function createEdge(node) {
|
|
6
2
|
return {
|
|
7
3
|
node: node,
|
|
8
4
|
cursor: "",
|
|
9
5
|
__typename: `${node.__typename}Edge`,
|
|
10
6
|
};
|
|
11
7
|
}
|
|
12
|
-
function uniqueEdges(edges) {
|
|
8
|
+
export function uniqueEdges(edges) {
|
|
13
9
|
const result = new Map();
|
|
14
10
|
edges.forEach(edge => {
|
|
15
11
|
result.set(`${edge.__typename}-${edge.node.__typename}-${edge.node.id}`, edge);
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uniqueNodes = uniqueNodes;
|
|
4
|
-
function uniqueNodes(nodes) {
|
|
1
|
+
export function uniqueNodes(nodes) {
|
|
5
2
|
const result = new Map();
|
|
6
3
|
nodes.forEach(node => {
|
|
7
4
|
result.set(`${node.__typename}-${node.id}`, node);
|
|
@@ -1,27 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
10
|
-
const react_1 = require("react");
|
|
11
|
-
const formatters_1 = require("@jobber/formatters");
|
|
12
|
-
const uniqueNodes_1 = require("./uniqueNodes");
|
|
13
|
-
const uniqueEdges_1 = require("./uniqueEdges");
|
|
14
|
-
const useIsMounted_1 = require("../useIsMounted");
|
|
15
|
-
function useCollectionQuery({ query, queryOptions, getCollectionByPath, subscription, }) {
|
|
1
|
+
import { useQuery, } from "@apollo/client";
|
|
2
|
+
import cloneDeep from "lodash/cloneDeep";
|
|
3
|
+
import { useCallback, useEffect, useState } from "react";
|
|
4
|
+
import { config } from "@jobber/formatters";
|
|
5
|
+
import { uniqueNodes } from "./uniqueNodes";
|
|
6
|
+
import { createEdge, uniqueEdges } from "./uniqueEdges";
|
|
7
|
+
import { useIsMounted } from "../useIsMounted";
|
|
8
|
+
export function useCollectionQuery({ query, queryOptions, getCollectionByPath, subscription, }) {
|
|
16
9
|
var _a, _b;
|
|
17
|
-
const { data, loading, refetch, error, fetchMore, subscribeToMore } =
|
|
18
|
-
const isMounted =
|
|
19
|
-
const [loadingRefresh, setLoadingRefresh] =
|
|
20
|
-
const [loadingNextPage, setLoadingNextPage] =
|
|
21
|
-
const [hookError, setHookError] =
|
|
10
|
+
const { data, loading, refetch, error, fetchMore, subscribeToMore } = useQuery(query, queryOptions);
|
|
11
|
+
const isMounted = useIsMounted();
|
|
12
|
+
const [loadingRefresh, setLoadingRefresh] = useState(false);
|
|
13
|
+
const [loadingNextPage, setLoadingNextPage] = useState(false);
|
|
14
|
+
const [hookError, setHookError] = useState();
|
|
22
15
|
const loadingInitialContent = loading && !loadingRefresh && !loadingNextPage;
|
|
23
16
|
const isSearching = !!((_a = queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.variables) === null || _a === void 0 ? void 0 : _a.searchTerm);
|
|
24
|
-
const refresh =
|
|
17
|
+
const refresh = useCallback(() => {
|
|
25
18
|
if (loadingInitialContent || loadingRefresh) {
|
|
26
19
|
return;
|
|
27
20
|
}
|
|
@@ -34,7 +27,7 @@ function useCollectionQuery({ query, queryOptions, getCollectionByPath, subscrip
|
|
|
34
27
|
variables: {},
|
|
35
28
|
updateQuery: (prev, { fetchMoreResult }) => fetchMoreResult || prev,
|
|
36
29
|
})
|
|
37
|
-
.catch(err =>
|
|
30
|
+
.catch(err => config.errorNotifier("Refetch Error", err))
|
|
38
31
|
.finally(() => {
|
|
39
32
|
if (isMounted.current) {
|
|
40
33
|
setLoadingRefresh(false);
|
|
@@ -47,7 +40,7 @@ function useCollectionQuery({ query, queryOptions, getCollectionByPath, subscrip
|
|
|
47
40
|
refetch,
|
|
48
41
|
isMounted,
|
|
49
42
|
]);
|
|
50
|
-
const nextPage =
|
|
43
|
+
const nextPage = useCallback(() => {
|
|
51
44
|
var _a;
|
|
52
45
|
if (loadingInitialContent || loadingRefresh || loadingNextPage) {
|
|
53
46
|
return;
|
|
@@ -65,7 +58,7 @@ function useCollectionQuery({ query, queryOptions, getCollectionByPath, subscrip
|
|
|
65
58
|
updateQuery: (prev, { fetchMoreResult }) => fetchMoreUpdateQueryHandler(prev, fetchMoreResult, getCollectionByPath),
|
|
66
59
|
})
|
|
67
60
|
.catch(err => {
|
|
68
|
-
|
|
61
|
+
config.errorNotifier("FetchMore Error", err);
|
|
69
62
|
setHookError(err);
|
|
70
63
|
})
|
|
71
64
|
.finally(() => {
|
|
@@ -83,14 +76,14 @@ function useCollectionQuery({ query, queryOptions, getCollectionByPath, subscrip
|
|
|
83
76
|
getCollectionByPath,
|
|
84
77
|
isMounted,
|
|
85
78
|
]);
|
|
86
|
-
|
|
79
|
+
useEffect(() => {
|
|
87
80
|
if (subscription == undefined)
|
|
88
81
|
return;
|
|
89
82
|
const subscriptionOptions = subscription.options || {};
|
|
90
83
|
// Reset this state so we can handle errors from the subscription
|
|
91
84
|
setHookError(undefined);
|
|
92
85
|
return subscribeToMore(Object.assign(Object.assign({}, subscriptionOptions), { document: subscription.document, updateQuery: (prev, { subscriptionData }) => subscribeToMoreHandler(isSearching, prev, getCollectionByPath, subscriptionData === null || subscriptionData === void 0 ? void 0 : subscriptionData.data, subscription.getNodeByPath), onError: err => {
|
|
93
|
-
|
|
86
|
+
config.errorNotifier("Subscribe to More Error", err);
|
|
94
87
|
setHookError(err);
|
|
95
88
|
} }));
|
|
96
89
|
},
|
|
@@ -128,7 +121,7 @@ function useCollectionQuery({ query, queryOptions, getCollectionByPath, subscrip
|
|
|
128
121
|
*/
|
|
129
122
|
function fetchMoreUpdateQueryHandler(prev, fetchMoreResult, getCollectionByPath) {
|
|
130
123
|
const nextCollection = getCollectionByPath(fetchMoreResult);
|
|
131
|
-
const output = (
|
|
124
|
+
const output = cloneDeep(prev);
|
|
132
125
|
const outputCollection = getCollectionByPath(output);
|
|
133
126
|
if (outputCollection === undefined || nextCollection === undefined) {
|
|
134
127
|
return output;
|
|
@@ -139,12 +132,12 @@ function fetchMoreUpdateQueryHandler(prev, fetchMoreResult, getCollectionByPath)
|
|
|
139
132
|
if (outputCollection.edges && nextCollection.edges) {
|
|
140
133
|
outputCollection.edges = getUpdatedEdges(outputCollection.edges, nextCollection.edges);
|
|
141
134
|
}
|
|
142
|
-
Object.assign(outputCollection, Object.assign({ pageInfo: (
|
|
135
|
+
Object.assign(outputCollection, Object.assign({ pageInfo: cloneDeep(nextCollection.pageInfo) }, getTotalCount(nextCollection.totalCount)));
|
|
143
136
|
return output;
|
|
144
137
|
}
|
|
145
138
|
function subscribeToMoreHandler(isSearching, prev, getCollectionByPath, subscriptionData, getNodeByPath) {
|
|
146
139
|
const node = getNodeByPath(subscriptionData);
|
|
147
|
-
const output = (
|
|
140
|
+
const output = cloneDeep(prev);
|
|
148
141
|
const outputCollection = getCollectionByPath(output);
|
|
149
142
|
if (outputCollection == undefined || node == undefined)
|
|
150
143
|
return output;
|
|
@@ -155,9 +148,9 @@ function subscribeToMoreHandler(isSearching, prev, getCollectionByPath, subscrip
|
|
|
155
148
|
outputCollection.nodes = getUpdatedNodes(outputCollection.nodes, [node], false);
|
|
156
149
|
}
|
|
157
150
|
if (outputCollection.edges) {
|
|
158
|
-
outputCollection.edges = getUpdatedEdges(outputCollection.edges, [
|
|
151
|
+
outputCollection.edges = getUpdatedEdges(outputCollection.edges, [createEdge(node)], false);
|
|
159
152
|
}
|
|
160
|
-
Object.assign(outputCollection, Object.assign({ pageInfo: (
|
|
153
|
+
Object.assign(outputCollection, Object.assign({ pageInfo: cloneDeep(outputCollection.pageInfo) }, getTotalCount(outputCollection.totalCount, 1)));
|
|
161
154
|
return output;
|
|
162
155
|
}
|
|
163
156
|
function getTotalCount(totalCount, additionalCount = 0) {
|
|
@@ -165,7 +158,7 @@ function getTotalCount(totalCount, additionalCount = 0) {
|
|
|
165
158
|
? { totalCount: totalCount + additionalCount }
|
|
166
159
|
: {};
|
|
167
160
|
}
|
|
168
|
-
function isAlreadyUpdated(outputCollection, newNode) {
|
|
161
|
+
export function isAlreadyUpdated(outputCollection, newNode) {
|
|
169
162
|
let edgesAlreadyUpdated = true;
|
|
170
163
|
let nodesAlreadyUpdated = true;
|
|
171
164
|
if (outputCollection.edges) {
|
|
@@ -184,11 +177,11 @@ function getUpdatedEdges(prevEdges, nextEdges, appendToEnd = true) {
|
|
|
184
177
|
const newEdges = appendToEnd
|
|
185
178
|
? [...prevEdges, ...nextEdges]
|
|
186
179
|
: [...nextEdges, ...prevEdges];
|
|
187
|
-
return
|
|
180
|
+
return uniqueEdges(newEdges);
|
|
188
181
|
}
|
|
189
182
|
function getUpdatedNodes(prevNodes, nextNodes, appendToEnd = true) {
|
|
190
183
|
const newNodes = appendToEnd
|
|
191
184
|
? [...prevNodes, ...nextNodes]
|
|
192
185
|
: [...nextNodes, ...prevNodes];
|
|
193
|
-
return
|
|
186
|
+
return uniqueNodes(newNodes);
|
|
194
187
|
}
|