about summary refs log tree commit diff
path: root/src/lib
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-04-12 13:02:15 +0100
committerGitHub <noreply@github.com>2024-04-12 13:02:15 +0100
commitbedb0c3fbd65b6520c97f22c99f10bb535a177bc (patch)
tree7107f34544bc7ac66147a846475dfaf40517a44e /src/lib
parente3e8f10538bba57f1cf298fd1205846f801557eb (diff)
downloadvoidsky-bedb0c3fbd65b6520c97f22c99f10bb535a177bc.tar.zst
Use getSuggestions endpoint behind the gate (#3499)
* Move suggested follows out of the component

* Add new suggestions implementation

* Put new endpoint behind the gate

* Make bottom less weird
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/statsig/gates.ts1
-rw-r--r--src/lib/statsig/statsig.tsx5
2 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/statsig/gates.ts b/src/lib/statsig/gates.ts
index 5a9582383..acf0b2aff 100644
--- a/src/lib/statsig/gates.ts
+++ b/src/lib/statsig/gates.ts
@@ -7,3 +7,4 @@ export type Gate =
   | 'new_search'
   | 'show_follow_back_label'
   | 'start_session_with_following'
+  | 'use_new_suggestions_endpoint'
diff --git a/src/lib/statsig/statsig.tsx b/src/lib/statsig/statsig.tsx
index 159438647..7513b945c 100644
--- a/src/lib/statsig/statsig.tsx
+++ b/src/lib/statsig/statsig.tsx
@@ -82,7 +82,10 @@ export function useGate(gateName: Gate): boolean {
     // This should not happen because of waitForInitialization={true}.
     console.error('Did not expected isLoading to ever be true.')
   }
-  return value
+  // This shouldn't technically be necessary but let's get a strong
+  // guarantee that a gate value can never change while mounted.
+  const [initialValue] = React.useState(value)
+  return initialValue
 }
 
 function toStatsigUser(did: string | undefined) {