@applicaster/zapp-react-native-utils 14.0.0-alpha.5333112458 → 14.0.0-alpha.5351122050

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.
Files changed (58) hide show
  1. package/actionsExecutor/ActionExecutorContext.tsx +0 -1
  2. package/actionsExecutor/ScreenActions.ts +20 -19
  3. package/analyticsUtils/AnalyticsEvents/sendHeaderClickEvent.ts +1 -1
  4. package/analyticsUtils/AnalyticsEvents/sendMenuClickEvent.ts +2 -1
  5. package/analyticsUtils/__tests__/analyticsUtils.test.js +0 -11
  6. package/analyticsUtils/index.tsx +3 -4
  7. package/analyticsUtils/manager.ts +1 -1
  8. package/appUtils/HooksManager/Hook.ts +4 -4
  9. package/appUtils/HooksManager/index.ts +11 -1
  10. package/appUtils/accessibilityManager/index.ts +3 -12
  11. package/appUtils/contextKeysManager/contextResolver.ts +29 -1
  12. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +5 -0
  13. package/appUtils/focusManager/__tests__/focusManager.test.js +1 -1
  14. package/appUtils/focusManager/index.ios.ts +10 -0
  15. package/appUtils/focusManager/index.ts +82 -11
  16. package/appUtils/focusManager/treeDataStructure/Tree/index.js +1 -1
  17. package/appUtils/focusManagerAux/utils/index.ts +106 -3
  18. package/arrayUtils/index.ts +1 -1
  19. package/componentsUtils/__tests__/isTabsScreen.test.ts +38 -0
  20. package/componentsUtils/index.ts +4 -1
  21. package/configurationUtils/__tests__/manifestKeyParser.test.ts +0 -1
  22. package/index.d.ts +0 -12
  23. package/navigationUtils/__tests__/mapContentTypesToRivers.test.ts +130 -0
  24. package/navigationUtils/index.ts +7 -5
  25. package/package.json +2 -3
  26. package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +15 -14
  27. package/reactHooks/cell-click/__tests__/index.test.js +3 -0
  28. package/reactHooks/debugging/__tests__/index.test.js +0 -1
  29. package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +47 -90
  30. package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +57 -37
  31. package/reactHooks/feed/index.ts +2 -0
  32. package/reactHooks/feed/useBatchLoading.ts +15 -8
  33. package/reactHooks/feed/useFeedLoader.tsx +39 -44
  34. package/reactHooks/feed/useLoadPipesDataDispatch.ts +57 -0
  35. package/reactHooks/feed/usePipesCacheReset.ts +2 -2
  36. package/reactHooks/flatList/useSequentialRenderItem.tsx +3 -3
  37. package/reactHooks/layout/__tests__/index.test.tsx +3 -1
  38. package/reactHooks/layout/useDimensions/__tests__/useDimensions.test.ts +34 -36
  39. package/reactHooks/layout/useDimensions/useDimensions.ts +2 -3
  40. package/reactHooks/layout/useLayoutVersion.ts +5 -5
  41. package/reactHooks/navigation/index.ts +5 -7
  42. package/reactHooks/navigation/useScreenStateStore.ts +3 -3
  43. package/reactHooks/resolvers/__tests__/useCellResolver.test.tsx +4 -0
  44. package/reactHooks/state/index.ts +1 -1
  45. package/reactHooks/state/useHomeRiver.ts +4 -2
  46. package/reactHooks/state/useRivers.ts +7 -8
  47. package/screenPickerUtils/index.ts +7 -0
  48. package/storage/ScreenSingleValueProvider.ts +25 -22
  49. package/storage/ScreenStateMultiSelectProvider.ts +26 -23
  50. package/testUtils/index.tsx +7 -8
  51. package/time/BackgroundTimer.ts +1 -1
  52. package/utils/__tests__/find.test.ts +36 -0
  53. package/utils/__tests__/pathOr.test.ts +37 -0
  54. package/utils/__tests__/startsWith.test.ts +30 -0
  55. package/utils/find.ts +3 -0
  56. package/utils/index.ts +8 -0
  57. package/utils/pathOr.ts +5 -0
  58. package/utils/startsWith.ts +9 -0
@@ -1,29 +1,33 @@
1
1
  import { renderHook } from "@testing-library/react-hooks";
2
- import * as reduxMockStore from "redux-mock-store";
3
- import thunk from "redux-thunk";
4
- import React from "react";
5
- import * as ReactRedux from "react-redux";
2
+ import { allFeedsIsReady, useBatchLoading } from "../useBatchLoading";
3
+ import { WrappedWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
4
+ import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
5
+ import { waitFor } from "@testing-library/react-native";
6
6
 
7
7
  jest.mock("../../navigation");
8
8
 
9
9
  jest.mock(
10
10
  "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext",
11
11
  () => ({
12
+ ...jest.requireActual(
13
+ "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext"
14
+ ),
12
15
  useScreenContext: jest.fn().mockReturnValue({ screen: {}, entry: {} }),
13
16
  })
14
17
  );
15
18
 
16
- const useBatchLoading = require("../useBatchLoading").useBatchLoading;
17
- const allFeedsIsReady = require("../useBatchLoading").allFeedsIsReady;
18
-
19
- const mockStore = reduxMockStore.default([thunk]);
20
-
21
- const wrapper: React.FC<any> = ({ children, store }) => (
22
- <ReactRedux.Provider store={store}>{children}</ReactRedux.Provider>
23
- );
19
+ const wrapper = WrappedWithProviders;
24
20
 
25
21
  describe("useBatchLoading", () => {
26
- const useDispatchSpy = jest.spyOn(ReactRedux, "useDispatch");
22
+ const data = [
23
+ { data: { source: "url1" }, component_type: "any" },
24
+ { data: { source: "url2" }, component_type: "any" },
25
+ { data: { source: "url3" }, component_type: "any" },
26
+ { data: { source: "url4" }, component_type: "any" },
27
+ { data: { source: "url5" }, component_type: "any" },
28
+ { data: { source: "url6" }, component_type: "any" },
29
+ // ... more items
30
+ ];
27
31
 
28
32
  beforeAll(() => {
29
33
  jest.useFakeTimers();
@@ -33,8 +37,8 @@ describe("useBatchLoading", () => {
33
37
  jest.clearAllMocks();
34
38
  });
35
39
 
36
- it("loadPipesData start loading not started requests", () => {
37
- const store = mockStore({
40
+ it("loadPipesData start loading not started requests", async () => {
41
+ const store = {
38
42
  zappPipes: {
39
43
  url1: {
40
44
  loading: true,
@@ -53,31 +57,21 @@ describe("useBatchLoading", () => {
53
57
  },
54
58
  },
55
59
  test: "true",
56
- });
57
-
58
- useDispatchSpy.mockReturnValue(store.dispatch);
60
+ };
59
61
 
60
62
  const initialBatchSize = 3;
61
63
  const riverId = "123";
62
64
 
63
- const data = [
64
- { data: { source: "url1" } },
65
- { data: { source: "url2" } },
66
- { data: { source: "url3" } },
67
- { data: { source: "url4" } },
68
- { data: { source: "url5" } },
69
- { data: { source: "url6" } },
70
- // ... more items
71
- ];
72
-
73
65
  renderHook(() => useBatchLoading(data, { initialBatchSize, riverId }), {
74
66
  wrapper,
75
67
  initialProps: { store },
76
68
  });
77
69
 
78
- const actions = store.getActions();
70
+ const actions = (appStore.getStore() as any).getActions();
79
71
 
80
- expect(actions).toHaveLength(2);
72
+ await waitFor(() => {
73
+ expect(actions).toHaveLength(2);
74
+ });
81
75
 
82
76
  expect(actions[0]).toMatchObject({
83
77
  type: "ZAPP_PIPES_REQUEST_START",
@@ -91,7 +85,7 @@ describe("useBatchLoading", () => {
91
85
  });
92
86
 
93
87
  it("loadPipesData start loading new feed when 1 feed is done loading and 1 is in loading state", () => {
94
- const store = mockStore({
88
+ const store = {
95
89
  zappPipes: {
96
90
  url1: {
97
91
  loading: false,
@@ -110,31 +104,17 @@ describe("useBatchLoading", () => {
110
104
  },
111
105
  },
112
106
  test: "true",
113
- });
114
-
115
- useDispatchSpy.mockReturnValue(store.dispatch);
107
+ };
116
108
 
117
109
  const initialBatchSize = 3;
118
110
  const riverId = "123";
119
111
 
120
- const data = [
121
- { data: { source: "url1" } },
122
- { data: { source: "url2" } },
123
- { data: { source: "url3" } },
124
- { data: { source: "url4" } },
125
- { data: { source: "url5" } },
126
- { data: { source: "url6" } },
127
- // ... more items
128
- ];
129
-
130
- expect(useDispatchSpy).toBeCalledTimes(0);
131
-
132
112
  renderHook(() => useBatchLoading(data, { initialBatchSize, riverId }), {
133
113
  wrapper,
134
114
  initialProps: { store },
135
115
  });
136
116
 
137
- const actions = store.getActions();
117
+ const actions = (appStore.getStore() as any).getActions();
138
118
 
139
119
  expect(actions).toHaveLength(1);
140
120
 
@@ -145,38 +125,26 @@ describe("useBatchLoading", () => {
145
125
  });
146
126
 
147
127
  it("loadPipesData has been called when no data cached", () => {
148
- const store = mockStore({
128
+ const store = {
149
129
  zappPipes: {},
150
130
  test: "true",
151
- });
152
-
153
- useDispatchSpy.mockReturnValue(store.dispatch);
131
+ };
154
132
 
155
133
  const initialBatchSize = 3;
156
134
  const riverId = "123";
157
135
 
158
- const data = [
159
- { data: { source: "url1" } },
160
- { data: { source: "url2" } },
161
- { data: { source: "url3" } },
162
- { data: { source: "url4" } },
163
- { data: { source: "url5" } },
164
- { data: { source: "url6" } },
165
- // ... more items
166
- ];
167
-
168
136
  renderHook(() => useBatchLoading(data, { initialBatchSize, riverId }), {
169
137
  wrapper,
170
138
  initialProps: { store },
171
139
  });
172
140
 
173
- const actions = store.getActions();
141
+ const actions = (appStore.getStore() as any).getActions();
174
142
 
175
143
  expect(actions).toHaveLength(3);
176
144
  });
177
145
 
178
146
  it("initial batch ready when all initial items loaded", () => {
179
- const store = mockStore({
147
+ const store = {
180
148
  zappPipes: {
181
149
  url1: {
182
150
  loading: false,
@@ -194,19 +162,11 @@ describe("useBatchLoading", () => {
194
162
  data: {},
195
163
  },
196
164
  },
197
- });
198
-
199
- useDispatchSpy.mockReturnValue(store.dispatch);
165
+ };
200
166
 
201
167
  const initialBatchSize = 3;
202
168
  const riverId = "123";
203
169
 
204
- const data: Partial<ZappUIComponent>[] = [
205
- { data: { source: "url1" } },
206
- { data: { source: "url2" } },
207
- { data: { source: "url3" } },
208
- ];
209
-
210
170
  const { result } = renderHook(
211
171
  () => useBatchLoading(data, { initialBatchSize, riverId }),
212
172
  { wrapper, initialProps: { store } }
@@ -216,12 +176,10 @@ describe("useBatchLoading", () => {
216
176
  });
217
177
 
218
178
  it("gallery-qb: loadPipesData should be called only once for first component in the gallery", () => {
219
- const store = mockStore({
179
+ const store = {
220
180
  zappPipes: {},
221
181
  test: "true",
222
- });
223
-
224
- useDispatchSpy.mockReturnValue(store.dispatch);
182
+ };
225
183
 
226
184
  const initialBatchSize = 3;
227
185
  const riverId = "123";
@@ -231,11 +189,11 @@ describe("useBatchLoading", () => {
231
189
  component_type: "gallery-qb",
232
190
  ui_components: [{ data: { source: "url1" } }],
233
191
  },
234
- { data: { source: "url2" } },
235
- { data: { source: "url3" } },
236
- { data: { source: "url4" } },
237
- { data: { source: "url5" } },
238
- { data: { source: "url6" } },
192
+ { data: { source: "url2" }, component_type: "any" },
193
+ { data: { source: "url3" }, component_type: "any" },
194
+ { data: { source: "url4" }, component_type: "any" },
195
+ { data: { source: "url5" }, component_type: "any" },
196
+ { data: { source: "url6" }, component_type: "any" },
239
197
  // ... more items
240
198
  ];
241
199
 
@@ -244,13 +202,13 @@ describe("useBatchLoading", () => {
244
202
  initialProps: { store },
245
203
  });
246
204
 
247
- const actions = store.getActions();
205
+ const actions = (appStore.getStore() as any).getActions();
248
206
 
249
207
  expect(actions).toHaveLength(1);
250
208
  });
251
209
 
252
210
  it("gallery-qb: initial batch ready when all initial items loaded", () => {
253
- const store = mockStore({
211
+ const store = {
254
212
  zappPipes: {
255
213
  url1: {
256
214
  loading: false,
@@ -258,20 +216,19 @@ describe("useBatchLoading", () => {
258
216
  data: {},
259
217
  },
260
218
  },
261
- });
262
-
263
- useDispatchSpy.mockReturnValue(store.dispatch);
219
+ };
264
220
 
265
221
  const initialBatchSize = 3;
266
222
  const riverId = "123";
267
223
 
268
- const data: Partial<ZappUIComponent>[] = [
224
+ const data = [
269
225
  {
270
226
  component_type: "gallery-qb",
271
- ui_components: [{ data: { source: "url1" } }],
227
+ data: {},
228
+ ui_components: [{ data: { source: "url1" } }] as any,
272
229
  },
273
- { data: { source: "url2" } },
274
- { data: { source: "url3" } },
230
+ { data: { source: "url2" }, component_type: "any" },
231
+ { data: { source: "url3" }, component_type: "any" },
275
232
  ];
276
233
 
277
234
  const { result } = renderHook(
@@ -2,15 +2,12 @@ import { renderHook } from "@testing-library/react-hooks";
2
2
  import * as R from "ramda";
3
3
  import * as zappPipesModule from "@applicaster/zapp-react-native-redux/ZappPipes";
4
4
  import * as reactReduxModules from "react-redux";
5
- import { Provider } from "react-redux";
6
5
  import * as React from "react";
7
- import configureStore from "redux-mock-store";
8
- import thunk from "redux-thunk";
9
6
  import * as useRouteHook from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useRoute";
10
7
  import * as useNavigationHooks from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
11
8
  import { useFeedLoader } from "../useFeedLoader";
12
-
13
- const mockStore = configureStore([thunk]);
9
+ import { WrappedWithProviders } from "../../../testUtils";
10
+ import { ScreenStateResolver } from "../../../appUtils/contextKeysManager/contextResolver";
14
11
 
15
12
  jest.useFakeTimers({ legacyFakeTimers: true });
16
13
 
@@ -55,13 +52,15 @@ const mockZappPipesData = {
55
52
 
56
53
  describe("useFeedLoader", () => {
57
54
  describe("with cached feed url", () => {
58
- const store = mockStore({
55
+ const store = {
59
56
  plugins: [],
60
57
  zappPipes: { "test://testfakeurl": mockZappPipesData },
61
- });
58
+ };
62
59
 
63
- const wrapper: React.FC<any> = ({ children }) => (
64
- <Provider store={store}>{children}</Provider>
60
+ const wrapper: React.FC<any> = ({ children, ...props }) => (
61
+ <WrappedWithProviders store={props.store || store}>
62
+ {children}
63
+ </WrappedWithProviders>
65
64
  );
66
65
 
67
66
  it("returns cached feed", () => {
@@ -110,8 +109,10 @@ describe("useFeedLoader", () => {
110
109
  describe("without cached feeds", () => {
111
110
  const feedUrl = "test://testfakeurl2";
112
111
 
113
- const wrapper: React.FC<any> = ({ children, store }) => (
114
- <Provider store={store}>{children}</Provider>
112
+ const wrapper: React.FC<any> = ({ children, ...props }) => (
113
+ <WrappedWithProviders store={props.store}>
114
+ {children}
115
+ </WrappedWithProviders>
115
116
  );
116
117
 
117
118
  it("It loads data for new url and returns it", () => {
@@ -123,10 +124,10 @@ describe("useFeedLoader", () => {
123
124
  .spyOn(zappPipesModule, "loadPipesData")
124
125
  .mockImplementation(jest.fn());
125
126
 
126
- const initialStore = mockStore({
127
+ const initialStore = {
127
128
  plugins: [],
128
129
  zappPipes: { "test://testfakeurl": "foobar" },
129
- });
130
+ };
130
131
 
131
132
  const { result, rerender } = renderHook(
132
133
  () => useFeedLoader({ feedUrl: "test://testfakeurl2" }),
@@ -135,20 +136,19 @@ describe("useFeedLoader", () => {
135
136
 
136
137
  expect(result.current.data).toBeNull();
137
138
 
138
- expect(loadPipesDataSpy).toBeCalledWith(feedUrl, {
139
+ expect(loadPipesDataSpy).toHaveBeenCalledWith(feedUrl, {
139
140
  clearCache: true,
140
141
  riverId: undefined,
142
+ callback: expect.any(Function),
141
143
  resolvers: {
142
- screen: {
143
- screenStateStore: undefined,
144
- },
144
+ screen: expect.any(ScreenStateResolver),
145
145
  },
146
146
  });
147
147
 
148
- const store2 = mockStore({
148
+ const store2 = {
149
149
  plugins: [],
150
150
  zappPipes: { "test://testfakeurl2": mockZappPipesData },
151
- });
151
+ };
152
152
 
153
153
  rerender({ store: store2 });
154
154
 
@@ -169,10 +169,10 @@ describe("useFeedLoader", () => {
169
169
  .spyOn(reactReduxModules, "useDispatch")
170
170
  .mockImplementation(() => jest.fn());
171
171
 
172
- const initialStore = mockStore({
172
+ const initialStore = {
173
173
  plugins: [],
174
174
  zappPipes: { "test://testfakeurl": "foobar" },
175
- });
175
+ };
176
176
 
177
177
  const { result, rerender } = renderHook(
178
178
  () => useFeedLoader({ feedUrl: "test://testfakeurl2" }),
@@ -181,20 +181,22 @@ describe("useFeedLoader", () => {
181
181
 
182
182
  expect(result.current.data).toBeNull();
183
183
 
184
- expect(loadPipesDataSpy).toBeCalledWith(feedUrl, {
184
+ expect(loadPipesDataSpy.mock.calls[0][0]).toBe(feedUrl);
185
+
186
+ expect(loadPipesDataSpy.mock.calls[0][1]).toMatchObject({
185
187
  clearCache: true,
186
188
  riverId: undefined,
187
189
  resolvers: {
188
190
  screen: {
189
- screenStateStore: undefined,
191
+ screenStateStore: expect.any(Function),
190
192
  },
191
193
  },
192
194
  });
193
195
 
194
- const store2 = mockStore({
196
+ const store2 = {
195
197
  plugins: [],
196
198
  zappPipes: { "test://testfakeurl2": mockZappPipesData },
197
- });
199
+ };
198
200
 
199
201
  rerender({ store: store2 });
200
202
 
@@ -207,8 +209,10 @@ describe("useFeedLoader", () => {
207
209
  const feedUrl = "test://testfakeurl";
208
210
  const feedUrlWithNext = "test://withnexttestfakeurl";
209
211
 
210
- const wrapper: React.FC<any> = ({ children, store }) => (
211
- <Provider store={store}>{children}</Provider>
212
+ const wrapper: React.FC<any> = ({ children, ...props }) => (
213
+ <WrappedWithProviders store={props.store || {}}>
214
+ {children}
215
+ </WrappedWithProviders>
212
216
  );
213
217
 
214
218
  describe("reloadData", () => {
@@ -221,10 +225,10 @@ describe("useFeedLoader", () => {
221
225
  .spyOn(reactReduxModules, "useDispatch")
222
226
  .mockImplementation(() => jest.fn());
223
227
 
224
- const initialStore = mockStore({
228
+ const initialStore = {
225
229
  plugins: [],
226
230
  zappPipes: { [feedUrl]: "foobar" },
227
- });
231
+ };
228
232
 
229
233
  const { result } = renderHook(() => useFeedLoader({ feedUrl }), {
230
234
  wrapper,
@@ -233,14 +237,22 @@ describe("useFeedLoader", () => {
233
237
 
234
238
  const { reloadData } = result.current;
235
239
 
236
- reloadData();
240
+ reloadData?.();
241
+
242
+ expect(loadPipesDataSpy).toHaveBeenCalled();
243
+
244
+ expect(
245
+ loadPipesDataSpy.mock.calls[loadPipesDataSpy.mock.calls.length - 1][0]
246
+ ).toBe(feedUrl);
237
247
 
238
- expect(loadPipesDataSpy).toBeCalledWith(feedUrl, {
248
+ expect(
249
+ loadPipesDataSpy.mock.calls[loadPipesDataSpy.mock.calls.length - 1][1]
250
+ ).toMatchObject({
239
251
  clearCache: true,
240
252
  silentRefresh: true,
241
253
  resolvers: {
242
254
  screen: {
243
- screenStateStore: undefined,
255
+ screenStateStore: expect.any(Function),
244
256
  },
245
257
  },
246
258
  });
@@ -262,10 +274,10 @@ describe("useFeedLoader", () => {
262
274
  .spyOn(reactReduxModules, "useDispatch")
263
275
  .mockImplementation(() => jest.fn());
264
276
 
265
- const initialStore = mockStore({
277
+ const initialStore = {
266
278
  plugins: [],
267
279
  zappPipes: { [feedUrlWithNext]: { data: { next: nextUrl } } },
268
- });
280
+ };
269
281
 
270
282
  const { result } = renderHook(
271
283
  () => useFeedLoader({ feedUrl: feedUrlWithNext }),
@@ -277,14 +289,22 @@ describe("useFeedLoader", () => {
277
289
 
278
290
  const { loadNext } = result.current;
279
291
 
280
- loadNext();
292
+ loadNext?.();
293
+
294
+ expect(loadPipesDataSpy).toHaveBeenCalled();
295
+
296
+ expect(
297
+ loadPipesDataSpy.mock.calls[loadPipesDataSpy.mock.calls.length - 1][0]
298
+ ).toBe(nextUrl);
281
299
 
282
- expect(loadPipesDataSpy).toBeCalledWith(nextUrl, {
300
+ expect(
301
+ loadPipesDataSpy.mock.calls[loadPipesDataSpy.mock.calls.length - 1][1]
302
+ ).toMatchObject({
283
303
  parentFeed: feedUrlWithNext,
284
304
  silentRefresh: true,
285
305
  resolvers: {
286
306
  screen: {
287
- screenStateStore: undefined,
307
+ screenStateStore: expect.any(Function),
288
308
  },
289
309
  },
290
310
  });
@@ -11,3 +11,5 @@ export { useBuildPipesUrl } from "./useBuildPipesUrl";
11
11
  export { usePipesCacheReset } from "./usePipesCacheReset";
12
12
 
13
13
  export { useBatchLoading } from "./useBatchLoading";
14
+
15
+ export { useLoadPipesDataDispatch } from "./useLoadPipesDataDispatch";
@@ -1,13 +1,12 @@
1
1
  import { complement, compose, isNil, map, min, prop, take, uniq } from "ramda";
2
- import { useDispatch } from "react-redux";
3
2
  import * as React from "react";
4
- import { useZappPipesFeeds } from "@applicaster/zapp-react-native-redux/hooks";
5
- import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
3
+ import { useZappPipesFeed } from "@applicaster/zapp-react-native-redux";
6
4
  import { isNilOrEmpty } from "../../reactUtils/helpers";
7
5
  import { ZappPipesSearchContext } from "@applicaster/zapp-react-native-ui-components/Contexts";
8
6
  import {
9
7
  getInflatedDataSourceUrl,
10
8
  getSearchContext,
9
+ useLoadPipesDataDispatch,
11
10
  } from "@applicaster/zapp-react-native-utils/reactHooks";
12
11
  import { isGallery } from "@applicaster/zapp-react-native-utils/componentsUtils";
13
12
  import { useScreenContext } from "../screen";
@@ -63,7 +62,6 @@ export const useBatchLoading = (
63
62
  componentsToRender: { data?: ZappDataSource; component_type: string }[],
64
63
  options: Options
65
64
  ) => {
66
- const dispatch = useDispatch();
67
65
  const { screen: screenContext, entry: entryContext } = useScreenContext();
68
66
  const [searchContext] = ZappPipesSearchContext.useZappPipesContext();
69
67
  const [hasEverBeenReady, setHasEverBeenReady] = React.useState(false);
@@ -118,7 +116,9 @@ export const useBatchLoading = (
118
116
  []
119
117
  );
120
118
 
121
- const feeds = useZappPipesFeeds(feedUrls);
119
+ const feeds = useZappPipesFeed(feedUrls);
120
+
121
+ const loadPipesDataDispatcher = useLoadPipesDataDispatch();
122
122
 
123
123
  // dispatch loadPipesData for each feed that is not loaded
124
124
  const runBatchLoading = React.useCallback(() => {
@@ -138,13 +138,20 @@ export const useBatchLoading = (
138
138
 
139
139
  if (mappedFeedUrl) {
140
140
  // 4. load data
141
- return dispatch(
142
- loadPipesData(mappedFeedUrl, { riverId: options.riverId })
141
+ return loadPipesDataDispatcher(
142
+ mappedFeedUrl,
143
+ {
144
+ riverId: options.riverId,
145
+ },
146
+ {
147
+ withResolvers: true,
148
+ withScreenRouteMapping: true,
149
+ }
143
150
  );
144
151
  }
145
152
  }
146
153
  });
147
- }, [feedUrls, feeds]);
154
+ }, [feedUrls, feeds, loadPipesDataDispatcher]);
148
155
 
149
156
  React.useEffect(() => {
150
157
  runBatchLoading();