diff --git a/apps/web/src/pages/home/index.tsx b/apps/web/src/pages/home/index.tsx index a3e24813..a413f36c 100644 --- a/apps/web/src/pages/home/index.tsx +++ b/apps/web/src/pages/home/index.tsx @@ -1,4 +1,5 @@ -import React, { useState } from "react"; +import React, { useLayoutEffect, useState } from "react"; +import { router } from "next/client"; import dynamic from "next/dynamic"; import Link from "next/link"; import { useRouter } from "next/router"; @@ -288,6 +289,12 @@ const InternalHome = observer(() => { activeCity$.coord.lon.get(), ]; + useLayoutEffect(() => { + if (activeCity$.id.get() === 0 && activeCity$.name.get() === "") { + void router.push("/search"); + } + }); + return (