Merge pull request #2275 from ethereum/fpanel

catch filepanel activation
pull/5370/head
yann300 3 years ago committed by GitHub
commit 43c21317d7
  1. 18
      libs/remix-ui/search/src/lib/context/context.tsx

@ -45,7 +45,7 @@ export interface SearchingStateInterface {
replaceAllInFile: (result: SearchResult) => Promise<void>
undoReplace: (buffer: undoBufferRecord) => Promise<void>
clearUndo: () => void
cancelSearch: (clearResults?:boolean) => Promise<void>
cancelSearch: (clearResults?: boolean) => Promise<void>
startSearch: () => void
}
@ -294,7 +294,7 @@ export const SearchProvider = ({
cancelSearch: async (clearResults = true) => {
plugin.cancel('fileManager')
if(clearResults) value.clearStats()
if (clearResults) value.clearStats()
value.setRun(false)
},
@ -323,7 +323,7 @@ export const SearchProvider = ({
})
plugin.on('fileManager', 'rootFolderChanged', async file => {
const workspace = await plugin.call('filePanel', 'getCurrentWorkspace')
if(workspace) value.setCurrentWorkspace(workspace.name)
if (workspace) value.setCurrentWorkspace(workspace.name)
setFiles(await getDirectory('/', plugin))
})
@ -336,9 +336,13 @@ export const SearchProvider = ({
await checkUndoState(file)
})
async function fetchWorkspace() {
const workspace = await plugin.call('filePanel', 'getCurrentWorkspace')
if(workspace) value.setCurrentWorkspace(workspace.name)
setFiles(await getDirectory('/', plugin))
try {
const workspace = await plugin.call('filePanel', 'getCurrentWorkspace')
if (workspace) value.setCurrentWorkspace(workspace.name)
setFiles(await getDirectory('/', plugin))
} catch (e) {
console.log(e)
}
}
fetchWorkspace()
@ -402,7 +406,7 @@ export const SearchProvider = ({
}
useEffect(() => {
if(state.count>500) {
if (state.count > 500) {
value.setClipped(true)
value.cancelSearch(false)
}

Loading…
Cancel
Save