From 28aaf21eb27e3eace45ef66e8a9ed0a3ec28e08d Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Fri, 3 May 2024 20:58:47 -0500 Subject: [PATCH] Load initialState for search plugin and fix run tab --- libs/remix-ui/run-tab/src/lib/actions/index.ts | 8 +++++--- libs/remix-ui/run-tab/src/lib/run-tab.tsx | 4 +++- libs/remix-ui/search/src/lib/components/Search.tsx | 2 +- libs/remix-ui/search/src/lib/context/context.tsx | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libs/remix-ui/run-tab/src/lib/actions/index.ts b/libs/remix-ui/run-tab/src/lib/actions/index.ts index b5c65e89f5..0df06aa448 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/index.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/index.ts @@ -22,11 +22,13 @@ declare global { const _paq = window._paq = window._paq || [] //eslint-disable-line let plugin: RunTab, dispatch: React.Dispatch = () => {} -export const initRunTab = (udapp: RunTab) => async (reducerDispatch: React.Dispatch) => { +export const initRunTab = (udapp: RunTab, resetEventsAndAccounts: boolean) => async (reducerDispatch: React.Dispatch) => { plugin = udapp dispatch = reducerDispatch - setupEvents(plugin, dispatch) - resetAndInit(plugin) + if (resetEventsAndAccounts) { + setupEvents(plugin, dispatch) + resetAndInit(plugin) + } } export const setAccountAddress = (account: string) => setAccount(dispatch, account) diff --git a/libs/remix-ui/run-tab/src/lib/run-tab.tsx b/libs/remix-ui/run-tab/src/lib/run-tab.tsx index 15c9be5bb6..ae569274ce 100644 --- a/libs/remix-ui/run-tab/src/lib/run-tab.tsx +++ b/libs/remix-ui/run-tab/src/lib/run-tab.tsx @@ -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]) diff --git a/libs/remix-ui/search/src/lib/components/Search.tsx b/libs/remix-ui/search/src/lib/components/Search.tsx index 11dcc9addd..43b2418015 100644 --- a/libs/remix-ui/search/src/lib/components/Search.tsx +++ b/libs/remix-ui/search/src/lib/components/Search.tsx @@ -15,7 +15,7 @@ export const SearchTab = (props) => { return ( <>
- + diff --git a/libs/remix-ui/search/src/lib/context/context.tsx b/libs/remix-ui/search/src/lib/context/context.tsx index 8e50f0b53e..336955c744 100644 --- a/libs/remix-ui/search/src/lib/context/context.tsx +++ b/libs/remix-ui/search/src/lib/context/context.tsx @@ -443,6 +443,7 @@ export const SearchProvider = ({ children = [], reducer = SearchReducer, initial } })() } + plugin.call('pluginStateLogger', 'logPluginState', 'search', state) }, [state.timeStamp]) return (