({ insightId }: { insightId: InsightShortId | 'new' })
| 43 | import { InsightVizNode } from '~/queries/schema' |
| 44 | |
| 45 | export function Insight({ insightId }: { insightId: InsightShortId | 'new' }): JSX.Element { |
| 46 | // insightSceneLogic |
| 47 | const { insightMode, subscriptionId } = useValues(insightSceneLogic) |
| 48 | const { setInsightMode } = useActions(insightSceneLogic) |
| 49 | |
| 50 | // insightLogic |
| 51 | const logic = insightLogic({ dashboardItemId: insightId || 'new' }) |
| 52 | const { |
| 53 | insightProps, |
| 54 | insightLoading, |
| 55 | filtersKnown, |
| 56 | filters, |
| 57 | canEditInsight, |
| 58 | insight, |
| 59 | insightChanged, |
| 60 | tagLoading, |
| 61 | insightSaving, |
| 62 | exporterResourceParams, |
| 63 | isUsingDataExploration, |
| 64 | showErrorMessage, |
| 65 | } = useValues(logic) |
| 66 | const { |
| 67 | saveInsight, |
| 68 | setInsightMetadata, |
| 69 | saveAs, |
| 70 | reportInsightViewedForRecentInsights, |
| 71 | abortAnyRunningQuery, |
| 72 | loadResults, |
| 73 | } = useActions(logic) |
| 74 | |
| 75 | // savedInsightsLogic |
| 76 | const { duplicateInsight, loadInsights } = useActions(savedInsightsLogic) |
| 77 | |
| 78 | // insightDataLogic |
| 79 | const { query } = useValues(insightDataLogic(insightProps)) |
| 80 | const { setQuery } = useActions(insightDataLogic(insightProps)) |
| 81 | |
| 82 | // other logics |
| 83 | useMountedLogic(insightCommandLogic(insightProps)) |
| 84 | const { hasAvailableFeature } = useValues(userLogic) |
| 85 | const { aggregationLabel } = useValues(groupsModel) |
| 86 | const { cohortsById } = useValues(cohortsModel) |
| 87 | const { mathDefinitions } = useValues(mathsLogic) |
| 88 | const { featureFlags } = useValues(featureFlagLogic) |
| 89 | const { tags } = useValues(tagsModel) |
| 90 | const { currentTeamId } = useValues(teamLogic) |
| 91 | const { push } = useActions(router) |
| 92 | |
| 93 | useEffect(() => { |
| 94 | reportInsightViewedForRecentInsights() |
| 95 | }, [insightId]) |
| 96 | |
| 97 | useEffect(() => { |
| 98 | // if users navigate away from insights then we may cancel an API call |
| 99 | // and when they come back they may see an error state, so clear it |
| 100 | if (showErrorMessage) { |
| 101 | loadResults() |
| 102 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…