@applicaster/zapp-react-native-ui-components 14.0.19-rc.0 → 14.0.19

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.
@@ -13,6 +13,7 @@ import { riverLogger } from "./logger";
13
13
  import { tvPluginsWithCellRenderer } from "../../const";
14
14
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
15
15
  import type { BehaviorSubject } from "rxjs";
16
+ import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
16
17
 
17
18
  export type RiverItemType = {
18
19
  item: ZappUIComponent;
@@ -110,33 +111,38 @@ function RiverItemComponent(props: RiverItemType) {
110
111
  CellRenderer = undefined;
111
112
  }
112
113
 
113
- React.useEffect(() => {
114
- riverLogger.log({
115
- message: "mounting component",
116
- data: { item, feedUrl, Component, CellRenderer },
117
- jsOnly: true,
118
- });
114
+ const isComponentMissing = isNilOrEmpty(Component);
119
115
 
120
- if (!CellRenderer && !isGroup(item)) {
116
+ /**
117
+ * TODO: Move this plugin existence check further up the stack (before ComponentsMap).
118
+ * Filtering items at the list-rendering or data-processing level would prevent
119
+ * mounting RiverItem entirely for missing components.
120
+ */
121
+ React.useEffect(() => {
122
+ if (isComponentMissing) {
121
123
  riverLogger.warning({
122
- message: "Cell Renderer is null - will fallback to default cell",
123
- data: { item, CellRenderer },
124
+ message: `Component ${item.component_type} is null - skipping rendering`,
125
+ });
126
+
127
+ onLoadFinished(index);
128
+ } else {
129
+ riverLogger.log({
130
+ message: "mounting component",
131
+ data: { item, feedUrl, Component, CellRenderer },
124
132
  jsOnly: true,
125
133
  });
134
+
135
+ if (!CellRenderer && !isGroup(item)) {
136
+ riverLogger.warning({
137
+ message: "Cell Renderer is null - will fallback to default cell",
138
+ data: { item, CellRenderer },
139
+ jsOnly: true,
140
+ });
141
+ }
126
142
  }
127
143
  }, []);
128
144
 
129
- if (!readyToBeDisplayed) {
130
- return null;
131
- }
132
-
133
- if (Component === null || typeof Component === "undefined") {
134
- riverLogger.warning({
135
- message: `Component ${item.component_type} is null - skipping rendering`,
136
- });
137
-
138
- onLoadFinished(index);
139
-
145
+ if (!readyToBeDisplayed || isComponentMissing) {
140
146
  return null;
141
147
  }
142
148
 
@@ -144,12 +144,23 @@ New signature: {Component, ErrorComponent, LoadingComponent, options}`
144
144
  [props, parent]
145
145
  );
146
146
 
147
+ const hasError = !!zappPipesData?.error;
148
+
147
149
  React.useEffect(() => {
148
150
  if (!skipOnLoadFinished && !isLoading) {
149
151
  onLoadFinished();
150
152
  }
151
153
  }, [isLoading]);
152
154
 
155
+ React.useEffect(() => {
156
+ if (hasError) {
157
+ onLoadFailed?.({
158
+ error: zappPipesData.error,
159
+ index: componentIndex,
160
+ });
161
+ }
162
+ }, [hasError, componentIndex, onLoadFailed, zappPipesData?.error]);
163
+
153
164
  if (isDataSourceEmpty(props) && allowsEmptyDataSource) {
154
165
  return RenderComponent(Component, componentProps);
155
166
  }
@@ -158,12 +169,7 @@ New signature: {Component, ErrorComponent, LoadingComponent, options}`
158
169
  return RenderComponent(LoadingComponent || Placeholder, componentProps);
159
170
  }
160
171
 
161
- if (zappPipesData?.error) {
162
- onLoadFailed?.({
163
- error: zappPipesData.error,
164
- index: componentIndex,
165
- });
166
-
172
+ if (hasError) {
167
173
  return RenderComponent(ErrorComponent, componentProps);
168
174
  }
169
175
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "14.0.19-rc.0",
3
+ "version": "14.0.19",
4
4
  "description": "Applicaster Zapp React Native ui components for the Quick Brick App",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "14.0.19-rc.0",
32
- "@applicaster/zapp-react-native-bridge": "14.0.19-rc.0",
33
- "@applicaster/zapp-react-native-redux": "14.0.19-rc.0",
34
- "@applicaster/zapp-react-native-utils": "14.0.19-rc.0",
31
+ "@applicaster/applicaster-types": "14.0.19",
32
+ "@applicaster/zapp-react-native-bridge": "14.0.19",
33
+ "@applicaster/zapp-react-native-redux": "14.0.19",
34
+ "@applicaster/zapp-react-native-utils": "14.0.19",
35
35
  "fast-json-stable-stringify": "^2.1.0",
36
36
  "promise": "^8.3.0",
37
37
  "url": "^0.11.0",