mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Streamline the project references context provider (#19387)
GitOrigin-RevId: 9af00459ec121a605b84809b349a0bc258896048
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import React, { memo, useCallback, useState } from 'react'
|
||||
import { useUserContext } from '@/shared/context/user-context'
|
||||
import { useReferencesContext } from '@/features/ide-react/context/references-context'
|
||||
import { useIdeReactContext } from '@/features/ide-react/context/ide-react-context'
|
||||
import { useConnectionContext } from '@/features/ide-react/context/connection-context'
|
||||
import { RefProviders } from '../../../../../types/user'
|
||||
@@ -9,7 +8,6 @@ import { useFileTreeOpenContext } from '@/features/ide-react/context/file-tree-o
|
||||
|
||||
export const FileTree = memo(function FileTree() {
|
||||
const user = useUserContext()
|
||||
const { indexAllReferences } = useReferencesContext()
|
||||
const { setStartedFreeTrial } = useIdeReactContext()
|
||||
const { isConnected, connectionState } = useConnectionContext()
|
||||
const { handleFileTreeInit, handleFileTreeSelect, handleFileTreeDelete } =
|
||||
@@ -19,10 +17,6 @@ export const FileTree = memo(function FileTree() {
|
||||
() => user.refProviders || {}
|
||||
)
|
||||
|
||||
function reindexReferences() {
|
||||
indexAllReferences(true)
|
||||
}
|
||||
|
||||
const setRefProviderEnabled = useCallback(
|
||||
(provider: keyof RefProviders, value = true) => {
|
||||
setRefProviders(refProviders => ({ ...refProviders, [provider]: value }))
|
||||
@@ -33,7 +27,6 @@ export const FileTree = memo(function FileTree() {
|
||||
return (
|
||||
<FileTreeRoot
|
||||
refProviders={refProviders}
|
||||
reindexReferences={reindexReferences}
|
||||
setRefProviderEnabled={setRefProviderEnabled}
|
||||
setStartedFreeTrial={setStartedFreeTrial}
|
||||
isConnected={isConnected || connectionState.reconnectAt !== null}
|
||||
|
||||
Reference in New Issue
Block a user