From a7be16357178a9af0a235c453ecfe43c158835d2 Mon Sep 17 00:00:00 2001 From: Hank Stoever Date: Wed, 6 Sep 2023 15:26:36 -0700 Subject: [PATCH] fix: update name page when search changed --- packages/bridge/package.json | 2 +- web/components/p/bridge/unwrap.tsx | 20 +------------------- web/components/p/name/name-page.tsx | 2 +- web/components/p/name/name-zonefile.tsx | 2 +- web/pages/names/[name].tsx | 6 ++++++ 5 files changed, 10 insertions(+), 22 deletions(-) diff --git a/packages/bridge/package.json b/packages/bridge/package.json index 502540a..287490a 100644 --- a/packages/bridge/package.json +++ b/packages/bridge/package.json @@ -8,7 +8,7 @@ }, "repository": "https://github.com/mechanismHQ/bns-x/tree/main/packages/png-ztxt", "types": "./dist/index.d.ts", - "main": "./dist/index.js", + "main": "./dist/index.mjs", "module": "./dist/index.mjs", "import": "./dist/index.mjs", "sideEffects": false, diff --git a/web/components/p/bridge/unwrap.tsx b/web/components/p/bridge/unwrap.tsx index 8eb24ad..20608e3 100644 --- a/web/components/p/bridge/unwrap.tsx +++ b/web/components/p/bridge/unwrap.tsx @@ -1,28 +1,10 @@ import React, { useMemo } from 'react'; import { useRouter } from 'next/router'; import { Text } from '@components/ui/text'; -import { - bridgeBurnScriptState, - bridgeInscriptionIdAtom, - bridgeUnwrapTxidAtom, - bridgeWrapTxidAtom, - fetchSignatureForInscriptionId, - inscribedNamesAtom, - inscriptionForNameAtom, - inscriptionIdForNameAtom, - verifiedBurnAddressState, -} from '@store/bridge'; +import { bridgeBurnScriptState, bridgeUnwrapTxidAtom, inscriptionForNameAtom } from '@store/bridge'; import { useAtom, useAtomValue } from 'jotai'; -import { loadable } from 'jotai/utils'; -import { useInput } from '@common/hooks/use-input'; import { CodeBlock } from '@components/code'; import { Button } from '@components/ui/button'; -import { useCopyToClipboard } from 'usehooks-ts'; -import { Input } from '@components/form'; -import { nameDetailsAtom } from '@store/names'; -import useDeepCompareEffect from 'use-deep-compare-effect'; -import { WrapTx } from '@components/p/bridge/wrap-tx'; -import { useBridgeWrap } from '@common/hooks/use-bridge-wrap'; import { Link } from '@components/link'; import { getInscriptionUrl, truncateMiddle } from '@common/utils'; import { DuplicateIcon } from '@components/icons/duplicate'; diff --git a/web/components/p/name/name-page.tsx b/web/components/p/name/name-page.tsx index 4fcd174..f6330b3 100644 --- a/web/components/p/name/name-page.tsx +++ b/web/components/p/name/name-page.tsx @@ -223,7 +223,7 @@ export const NamePage: React.FC<{ children?: React.ReactNode; name?: string }> = Zonefile {nameDetails.zonefile && } -
+
{ const zonefile = new ZoneFile(_zf).zoneFile; return ( - +
Type diff --git a/web/pages/names/[name].tsx b/web/pages/names/[name].tsx index 6e1708f..1a44831 100644 --- a/web/pages/names/[name].tsx +++ b/web/pages/names/[name].tsx @@ -4,6 +4,8 @@ import { NamePage } from '@components/p/name/name-page'; import { withSSRProps } from '@common/page-utils'; import { useHydrateAtoms } from 'jotai/utils'; import { currentNameAtom } from '@store/names'; +import { useEffect } from 'react'; +import { useSetAtom } from 'jotai'; export const getServerSideProps = withSSRProps(ctx => { return { @@ -13,6 +15,10 @@ export const getServerSideProps = withSSRProps(ctx => { const Name: NextPage<{ name: string }> = ({ name }) => { useHydrateAtoms([[currentNameAtom, name]]); + const setName = useSetAtom(currentNameAtom); + useEffect(() => { + setName(name); + }, [name, setName]); return (