useSearchBox trigger search with search parameters

I am using nextjs + react instantsearch hooks for a project.
I need to be able to trigger search when visiting a page with search parameters in url. For example, (/blog?search=hello).
I would like to instantly see search results (hits) of query ‘hello’, when visiting such page.
I wasn’t able to find any solution by Algolia, therefore was thinking to trigger refine(router.query.search) on initial load, but the method does not work in useEffect hook. Could you suggest a way to handle this situation?