Load initialState for search plugin and fix run tab

pull/4798/head
ioedeveloper 7 months ago
parent ed662197db
commit 28aaf21eb2
  1. 4
      libs/remix-ui/run-tab/src/lib/actions/index.ts
  2. 4
      libs/remix-ui/run-tab/src/lib/run-tab.tsx
  3. 2
      libs/remix-ui/search/src/lib/components/Search.tsx
  4. 1
      libs/remix-ui/search/src/lib/context/context.tsx

@ -22,11 +22,13 @@ declare global {
const _paq = window._paq = window._paq || [] //eslint-disable-line
let plugin: RunTab, dispatch: React.Dispatch<any> = () => {}
export const initRunTab = (udapp: RunTab) => async (reducerDispatch: React.Dispatch<any>) => {
export const initRunTab = (udapp: RunTab, resetEventsAndAccounts: boolean) => async (reducerDispatch: React.Dispatch<any>) => {
plugin = udapp
dispatch = reducerDispatch
if (resetEventsAndAccounts) {
setupEvents(plugin, dispatch)
resetAndInit(plugin)
}
}
export const setAccountAddress = (account: string) => setAccount(dispatch, account)

@ -83,8 +83,10 @@ export function RunTabUI(props: RunTabProps) {
useEffect(() => {
if (!props.initialState) {
initRunTab(plugin)(dispatch)
initRunTab(plugin, true)(dispatch)
plugin.onInitDone()
} else {
initRunTab(plugin, false)(dispatch)
}
}, [plugin])

@ -15,7 +15,7 @@ export const SearchTab = (props) => {
return (
<>
<div className="search_plugin_search_tab pr-4 px-2 pb-4">
<SearchProvider platform={platform} plugin={plugin}>
<SearchProvider platform={platform} plugin={plugin} initialState={props.initialState}>
<FindContainer></FindContainer>
<Include></Include>
<Exclude></Exclude>

@ -443,6 +443,7 @@ export const SearchProvider = ({ children = [], reducer = SearchReducer, initial
}
})()
}
plugin.call('pluginStateLogger', 'logPluginState', 'search', state)
}, [state.timeStamp])
return (

Loading…
Cancel
Save