callstack / callstack/super-app-showcase

Error while running bundled application on newest versions

Open
#141 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
637
Forks
131
PR merge metrics
No merged PRs in 30d

Description

## Environment

Normal RN dev setup on macos

## Description

While running bundled miniapps I've encountered a strange error:

Application is crashing with ` Warning: TypeError: Cannot read property 'validated' of undefined` error.


After some investigation and in-depth debugging we've found that error is originating from `ScrollView` and going even deeper by this bit in bundle:
```js
function cloneAndReplaceKey(oldElement, newKey) {
newKey = ReactElement(oldElement.type, newKey, void 0, void 0, oldElement._owner, oldElement.props);
newKey._store.validated = oldElement._store.validated;
return newKey;
}
```


## Reproducible Demo

- Clone my PR with updated deps: #140
- bundle `shopping` app: `cd packages/shopping && pnpm bundle:ios`
- host bundle locally only on different port, eg: `python3 -m http.server -d build/generated/ios 9008`
- edit Host app's rspack config so Shopping will be taken from previously selected port:
```diff js
- shopping: `shopping@http://localhost:9001/mf-manifest.json`,
+ shopping: `shopping@http://localhost:9008/mf-manifest.json`,
```
- launch and install the app (`pnpm start` and `pnpm:host ios` in separate terminal window
- inside the application navigate to Services tab and then tap on Shopping card
- app crash 💥

Ugly temp fix:
To confirm remove react navigation from mini app and replace ScrollView usage with basic View component in main navigator like so:
```diff
const MainNavigator = () => {
- return (
-
-
-
- );
+ return ;
};
```
additionally inside `HomeScreen` replace `ScrollView` with normal `View`
```diff
const HomeScreen = () => {
return (
-
....
```

Bundle the Shopping mini app and host it locally again, rester Host's app server and app should work as expected.

1. App crash -> https://github.com/user-attachments/assets/91c16c6d-a6fe-4e41-ba98-da6e9e1f4010
2. Ugly temp fix -> https://github.com/user-attachments/assets/dc8d9470-4bfd-4207-8e6d-c20dedd7f832

What's interesting is that when bundle is created with `--dev true` flag all works normally as well

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.