Load initialState for search plugin and fix run tab

pull/4798/head
ioedeveloper 7 months ago
parent ed662197db
commit 28aaf21eb2
  1. 8
      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 const _paq = window._paq = window._paq || [] //eslint-disable-line
let plugin: RunTab, dispatch: React.Dispatch<any> = () => {} 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 plugin = udapp
dispatch = reducerDispatch dispatch = reducerDispatch
setupEvents(plugin, dispatch) if (resetEventsAndAccounts) {
resetAndInit(plugin) setupEvents(plugin, dispatch)
resetAndInit(plugin)
}
} }
export const setAccountAddress = (account: string) => setAccount(dispatch, account) export const setAccountAddress = (account: string) => setAccount(dispatch, account)

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

@ -15,7 +15,7 @@ export const SearchTab = (props) => {
return ( return (
<> <>
<div className="search_plugin_search_tab pr-4 px-2 pb-4"> <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> <FindContainer></FindContainer>
<Include></Include> <Include></Include>
<Exclude></Exclude> <Exclude></Exclude>

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

Loading…
Cancel
Save