@applicaster/quick-brick-core 15.0.0-alpha.4200413542 → 15.0.0-alpha.4225160176
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.
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
getTargetRoute,
|
|
8
8
|
usesVideoModal,
|
|
9
9
|
} from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
10
|
-
import { last } from "@applicaster/zapp-react-native-utils/utils";
|
|
10
|
+
import { clone, last } from "@applicaster/zapp-react-native-utils/utils";
|
|
11
11
|
import {
|
|
12
12
|
allowedOrientationsForScreen,
|
|
13
13
|
useGetScreenOrientation,
|
|
@@ -246,22 +246,24 @@ export function NavigationProvider({ children }: Props) {
|
|
|
246
246
|
const screen = rivers[screenId];
|
|
247
247
|
const parent = findParent(context, navigator.currentRoute);
|
|
248
248
|
|
|
249
|
+
const entryClone = clone(entry);
|
|
250
|
+
|
|
249
251
|
if (!screen) {
|
|
250
252
|
logger.warn({
|
|
251
253
|
message: `Cannot resolve type mapping for ${screenId} id`,
|
|
252
|
-
data: { entry, screenId },
|
|
254
|
+
data: { entry: entryClone, screenId },
|
|
253
255
|
});
|
|
254
256
|
|
|
255
257
|
return;
|
|
256
258
|
}
|
|
257
259
|
|
|
258
260
|
if (parent) {
|
|
259
|
-
|
|
261
|
+
entryClone.parent = parent?.data;
|
|
260
262
|
|
|
261
|
-
|
|
263
|
+
entryClone.parentId = parent?.id;
|
|
262
264
|
}
|
|
263
265
|
|
|
264
|
-
dispatch(setNestedContent(pathname,
|
|
266
|
+
dispatch(setNestedContent(pathname, entryClone, screen));
|
|
265
267
|
};
|
|
266
268
|
|
|
267
269
|
const pushItem = (item, options = {}) => {
|
|
@@ -450,4 +450,56 @@ describe("<NavigationProvider />", () => {
|
|
|
450
450
|
});
|
|
451
451
|
});
|
|
452
452
|
});
|
|
453
|
+
|
|
454
|
+
describe("setNestedScreenContent", () => {
|
|
455
|
+
it("should clone the entry object before modifying it", () => {
|
|
456
|
+
const originalEntry = {
|
|
457
|
+
id: "test-entry",
|
|
458
|
+
type: {
|
|
459
|
+
value: "feed",
|
|
460
|
+
},
|
|
461
|
+
title: "Test Entry",
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
const entryBeforeCall = structuredClone(originalEntry);
|
|
465
|
+
|
|
466
|
+
act(() => {
|
|
467
|
+
const view = getByTestId(wrapper, "WrapperView");
|
|
468
|
+
view.props.navigator.setNestedScreenContent(originalEntry, "A1234");
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
// Verify that the original entry object has not been modified
|
|
472
|
+
expect(originalEntry).toEqual(entryBeforeCall);
|
|
473
|
+
expect(originalEntry.parent).toBeUndefined();
|
|
474
|
+
expect(originalEntry.parentId).toBeUndefined();
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
it("should not mutate the original entry when parent exists", () => {
|
|
478
|
+
// First push a route to create a parent context
|
|
479
|
+
act(() => {
|
|
480
|
+
const view = getByTestId(wrapper, "WrapperView");
|
|
481
|
+
view.props.navigator.push(rivers.A1234);
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
const originalEntry = {
|
|
485
|
+
id: "test-entry",
|
|
486
|
+
type: {
|
|
487
|
+
value: "feed",
|
|
488
|
+
},
|
|
489
|
+
title: "Test Entry",
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
const entryBeforeCall = structuredClone(originalEntry);
|
|
493
|
+
|
|
494
|
+
act(() => {
|
|
495
|
+
const view = getByTestId(wrapper, "WrapperView");
|
|
496
|
+
view.props.navigator.setNestedScreenContent(originalEntry, "B4567");
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
// Verify that the original entry object has not been modified
|
|
500
|
+
expect(originalEntry).toEqual(entryBeforeCall);
|
|
501
|
+
expect(originalEntry.parent).toBeUndefined();
|
|
502
|
+
expect(originalEntry.parentId).toBeUndefined();
|
|
503
|
+
});
|
|
504
|
+
});
|
|
453
505
|
});
|
|
@@ -60,7 +60,7 @@ export const previousStackEntriesSelector = createSelector(
|
|
|
60
60
|
export const lastEntrySelector = createSelector(
|
|
61
61
|
navigationStackSelector,
|
|
62
62
|
R.compose(R.last, R.when(R.has("mainStack"), R.prop("mainStack")))
|
|
63
|
-
) as (state: any) =>
|
|
63
|
+
) as (state: any) => NavigationScreenState | undefined;
|
|
64
64
|
|
|
65
65
|
// Selector extracting identifiers of plugins requiring startup execution
|
|
66
66
|
export const startUpHookPluginIdentifiersSelector = createSelector(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-core",
|
|
3
|
-
"version": "15.0.0-alpha.
|
|
3
|
+
"version": "15.0.0-alpha.4225160176",
|
|
4
4
|
"description": "Core package for Applicaster's Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "15.0.0-alpha.
|
|
32
|
-
"@applicaster/quick-brick-core-plugins": "15.0.0-alpha.
|
|
33
|
-
"@applicaster/zapp-pipes-v2-client": "15.0.0-alpha.
|
|
34
|
-
"@applicaster/zapp-react-native-bridge": "15.0.0-alpha.
|
|
35
|
-
"@applicaster/zapp-react-native-redux": "15.0.0-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-ui-components": "15.0.0-alpha.
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "15.0.0-alpha.
|
|
31
|
+
"@applicaster/applicaster-types": "15.0.0-alpha.4225160176",
|
|
32
|
+
"@applicaster/quick-brick-core-plugins": "15.0.0-alpha.4225160176",
|
|
33
|
+
"@applicaster/zapp-pipes-v2-client": "15.0.0-alpha.4225160176",
|
|
34
|
+
"@applicaster/zapp-react-native-bridge": "15.0.0-alpha.4225160176",
|
|
35
|
+
"@applicaster/zapp-react-native-redux": "15.0.0-alpha.4225160176",
|
|
36
|
+
"@applicaster/zapp-react-native-ui-components": "15.0.0-alpha.4225160176",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "15.0.0-alpha.4225160176",
|
|
38
38
|
"atob": "^2.1.2",
|
|
39
39
|
"axios": "^0.28.0",
|
|
40
40
|
"btoa": "^1.2.1",
|