fix: default implementation useFeatureFlags (#1068)

pull/3484/head
Ritik Kapoor 2024-02-26 20:52:31 +00:00 committed by Harness
parent 98fdb3da03
commit 64114fd250
2 changed files with 4 additions and 3 deletions

View File

@ -17,13 +17,14 @@
import React, { useState, useContext, useEffect, useMemo } from 'react'
import { matchPath } from 'react-router-dom'
import { useAtom } from 'jotai'
import { noop } from 'lodash-es'
import { noop, merge } from 'lodash-es'
import { useGet } from 'restful-react'
import type { AppProps } from 'AppProps'
import { routes } from 'RouteDefinitions'
import type { TypesUser } from 'services/code'
import { currentUserAtom } from 'atoms/currentUser'
import { newCacheStrategy } from 'utils/CacheStrategy'
import { useFeatureFlags } from 'hooks/useFeatureFlag'
interface AppContextProps extends AppProps {
setAppContext: (value: Partial<AppProps>) => void
@ -62,7 +63,7 @@ export const AppContextProvider: React.FC<{ value: AppProps }> = React.memo(func
lazy: true
})
const [currentUser, setCurrentUser] = useAtom(currentUserAtom)
const [appStates, setAppStates] = useState<AppProps>(initialValue)
const [appStates, setAppStates] = useState<AppProps>(merge({ hooks: { useFeatureFlags } }, initialValue))
useEffect(() => {
// Fetch current user when conditions to fetch it matched and

View File

@ -38,7 +38,7 @@ ReactDOM.render(
useExecutionDataHook: noop,
useLogsContent: noop,
useLogsStreaming: noop,
useFeatureFlags: useFeatureFlags
useFeatureFlags
}}
currentUser={defaultCurrentUser}
currentUserProfileURL=""