@applicaster/zapp-react-native-utils 13.0.0-alpha.3592223128 → 13.0.0-alpha.4585770583

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.
@@ -40,14 +40,13 @@ export const playerFactory = (
40
40
 
41
41
  const playerPlugin = findPluginByIdentifier(IDENTIFIER, plugins);
42
42
 
43
- if (!playerPlugin?.module?.playerProtocol) {
43
+ if (!playerPlugin) {
44
44
  return null;
45
45
  }
46
46
 
47
- const playerProtocol: PlayerConstructor = playerPlugin.module.playerProtocol(
48
- config?.screenConfig,
49
- config?.entry
50
- );
47
+ // TODO: Fix type:
48
+ const playerProtocol: PlayerConstructor =
49
+ playerPlugin?.module?.playerProtocol(config?.screenConfig);
51
50
 
52
51
  const playerView = (playerProtocol as any)?.Component || null;
53
52
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "13.0.0-alpha.3592223128",
3
+ "version": "13.0.0-alpha.4585770583",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "13.0.0-alpha.3592223128",
31
+ "@applicaster/applicaster-types": "13.0.0-alpha.4585770583",
32
32
  "buffer": "^5.2.1",
33
33
  "camelize": "^1.0.0",
34
34
  "create-react-context": "^0.2.3",
@@ -1,11 +1,12 @@
1
1
  import React, { useEffect } from "react";
2
+ import { path } from "ramda";
2
3
  import { useDispatch } from "react-redux";
3
4
 
4
5
  import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
5
6
  import { useZappPipesFeed } from "@applicaster/zapp-react-native-redux/hooks";
6
7
 
7
8
  import { reactHooksLogger } from "../logger";
8
- import { useIsInitialRender, shouldUseCachedData } from "../utils";
9
+ import { useIsInitialRender } from "../utils";
9
10
  import { useInflatedUrl } from "./useInflatedUrl";
10
11
  import { useRoute } from "../navigation";
11
12
 
@@ -55,6 +56,8 @@ export const useFeedLoader = ({
55
56
 
56
57
  const currentFeed = useZappPipesFeed(callableFeedUrl);
57
58
 
59
+ const cachedFeed = React.useMemo(() => path(["data"])(currentFeed), []);
60
+
58
61
  const riverId = screenData?.id;
59
62
 
60
63
  const reloadData = React.useCallback<ReloadDataFunction>(
@@ -91,9 +94,7 @@ export const useFeedLoader = ({
91
94
 
92
95
  // If feed doesn't exist, load it
93
96
  useEffect(() => {
94
- if (
95
- shouldUseCachedData(callableFeedUrl, currentFeed, pipesOptions.clearCache)
96
- ) {
97
+ if (!cachedFeed || pipesOptions.clearCache) {
97
98
  if (callableFeedUrl) {
98
99
  dispatch(loadPipesData(callableFeedUrl, { ...pipesOptions, riverId }));
99
100
  } else {
@@ -30,16 +30,3 @@ export const useIsInitialRender = (): boolean => {
30
30
 
31
31
  return isInitialRenderRef.current;
32
32
  };
33
-
34
- export const checkIsLocalFeed = (feedUrl) => feedUrl?.startsWith("pipesv2://");
35
-
36
- export const shouldUseCachedData = (
37
- url: string,
38
- feed: ZappPipesData | null,
39
- clearCache: boolean
40
- ) => {
41
- const currentFeedHasData = feed?.data;
42
- const isLocalFeed = checkIsLocalFeed(url);
43
-
44
- return !currentFeedHasData || clearCache || isLocalFeed;
45
- };