about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAnsh Nanda <anshnanda10@gmail.com>2023-05-16 16:27:38 -0700
committerAnsh Nanda <anshnanda10@gmail.com>2023-05-16 16:27:38 -0700
commit1e54125f7f046742e08b7ea24ce7c546b5e5f83c (patch)
tree1572069e69a67674c7412548cc88202700298bfb
parent3f41d3db2603e75b6443487ce261a05f8e14076d (diff)
downloadvoidsky-1e54125f7f046742e08b7ea24ce7c546b5e5f83c.tar.zst
reload AlgoItem on focus via prop
-rw-r--r--src/view/com/algos/AlgoItem.tsx6
-rw-r--r--src/view/com/util/post-embeds/index.tsx1
2 files changed, 6 insertions, 1 deletions
diff --git a/src/view/com/algos/AlgoItem.tsx b/src/view/com/algos/AlgoItem.tsx
index b52a7e00d..ffb8791a8 100644
--- a/src/view/com/algos/AlgoItem.tsx
+++ b/src/view/com/algos/AlgoItem.tsx
@@ -24,11 +24,13 @@ const AlgoItem = observer(
     style,
     showBottom = true,
     onLongPress,
+    reloadOnFocus = false,
   }: {
     item: AlgoItemModel
     style?: StyleProp<ViewStyle>
     showBottom?: boolean
     onLongPress?: () => void
+    reloadOnFocus?: boolean
   }) => {
     const store = useStores()
     const pal = usePalette('default')
@@ -36,7 +38,9 @@ const AlgoItem = observer(
 
     // TODO: this is pretty hacky, but it works for now
     useFocusEffect(() => {
-      item.reload()
+      if (reloadOnFocus) {
+        item.reload()
+      }
     })
 
     return (
diff --git a/src/view/com/util/post-embeds/index.tsx b/src/view/com/util/post-embeds/index.tsx
index 3eb2720c0..621bd7c0f 100644
--- a/src/view/com/util/post-embeds/index.tsx
+++ b/src/view/com/util/post-embeds/index.tsx
@@ -174,6 +174,7 @@ export function PostEmbeds({
       <AlgoItem
         item={new AlgoItemModel(store, embed.record)}
         style={[pal.view, pal.border, styles.extOuter]}
+        reloadOnFocus={true}
       />
     )
   }