|
1 | | -import React, { useState, useEffect, useMemo, useRef } from "react"; |
| 1 | +import React, { useState, useEffect, useRef } from "react"; |
2 | 2 | import { |
3 | 3 | Button, |
4 | 4 | Checkbox, |
@@ -31,7 +31,7 @@ import { DGSupabaseClient } from "@repo/database/lib/client"; |
31 | 31 | import internalError from "~/utils/internalError"; |
32 | 32 | import SuggestiveModeSettings from "./SuggestiveModeSettings"; |
33 | 33 | import { BlockPropFeatureFlagPanel } from "./components/BlockPropFeatureFlagPanel"; |
34 | | -import { getFeatureFlag } from "./utils/accessors"; |
| 34 | +import { useFeatureFlag } from "./utils/hooks"; |
35 | 35 |
|
36 | 36 | const NodeRow = ({ node }: { node: PConceptFull }) => { |
37 | 37 | return ( |
@@ -256,7 +256,7 @@ const MigrationTab = (): React.ReactElement => { |
256 | 256 | const [useMigrationResults, setMigrationResults] = useState<string>(""); |
257 | 257 | const [useOngoing, setOngoing] = useState<boolean>(false); |
258 | 258 | const [useDryRun, setDryRun] = useState<boolean>(false); |
259 | | - const enabled = getFeatureFlag("Reified Relation Triples"); |
| 259 | + const enabled = useFeatureFlag("Reified Relation Triples"); |
260 | 260 | const doMigrateRelations = async () => { |
261 | 261 | setOngoing(true); |
262 | 262 | try { |
@@ -375,23 +375,18 @@ const FeatureFlagsTab = (): React.ReactElement => { |
375 | 375 |
|
376 | 376 | <Alert |
377 | 377 | isOpen={isInstructionOpen} |
378 | | - onConfirm={() => window.location.reload()} |
| 378 | + onConfirm={() => setIsInstructionOpen(false)} |
379 | 379 | onCancel={() => setIsInstructionOpen(false)} |
380 | | - confirmButtonText="Reload Graph" |
381 | | - cancelButtonText="Later" |
| 380 | + confirmButtonText="Got it" |
382 | 381 | intent={Intent.PRIMARY} |
383 | 382 | > |
384 | 383 | <p> |
385 | 384 | If this is the first time enabling it, you will need to generate and |
386 | 385 | upload all node embeddings to supabase. |
387 | 386 | </p> |
388 | 387 | <p> |
389 | | - Please reload the graph to see the new 'Suggestive Mode' |
390 | | - tab. |
391 | | - </p> |
392 | | - <p> |
393 | | - Then go to Suggestive Mode{" "} |
394 | | - {"-> Sync Config -> Click on 'Generate & Upload All Node Embeddings'"} |
| 388 | + Go to the new 'Suggestive Mode' tab, then Sync Config{" "} |
| 389 | + {"-> Click on 'Generate & Upload All Node Embeddings'"} |
395 | 390 | </p> |
396 | 391 | </Alert> |
397 | 392 |
|
@@ -422,10 +417,7 @@ const FeatureFlagsTab = (): React.ReactElement => { |
422 | 417 |
|
423 | 418 | const AdminPanel = (): React.ReactElement => { |
424 | 419 | const [selectedTabId, setSelectedTabId] = useState<TabId>("admin"); |
425 | | - const suggestiveModeEnabled = useMemo( |
426 | | - () => getFeatureFlag("Suggestive Mode Enabled"), |
427 | | - [], |
428 | | - ); |
| 420 | + const suggestiveModeEnabled = useFeatureFlag("Suggestive Mode Enabled"); |
429 | 421 |
|
430 | 422 | return ( |
431 | 423 | <Tabs |
|
0 commit comments