Skip to content

Commit

Permalink
fix active address
Browse files Browse the repository at this point in the history
  • Loading branch information
ankushKun committed May 24, 2024
1 parent 1251c6e commit 48c979b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion next_app/src/components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ export default function Layout() {
return (
<>
<Head>
<title>BetterIDEa | {globalState.activeProject || "Home"}</title>
<title>{`BetterIDEa ${globalState.activeProject && ("| " + globalState.activeProject)}`}</title>
</Head>

<TopBar />
Expand Down
20 changes: 13 additions & 7 deletions next_app/src/pages/codecell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default function CodeCell() {
console.log("autoconn", autoconnect)

useEffect(() => {

if (searchParams.size > 0) {
if (searchParams.has("code")) {
setCode(searchParams.get("code") as string)
Expand All @@ -52,14 +53,19 @@ export default function CodeCell() {
}

}
if (autoconnect && !mounted) {
window.arweaveWallet.getActiveAddress().then((addr: string) => {
connectHandler();
setMounted(true);
}).catch(() => {
setAutoconnect(false);
});
async function run() {
if (autoconnect && !mounted) {
try {
const addr = await window.arweaveWallet.getActiveAddress()
setWalletAddr(addr);
setAutoconnect(true);
}
catch {
setAutoconnect(false);
}
}
}
run()
}, [searchParams, autoconnect, mounted])

async function connectHandler() {
Expand Down

0 comments on commit 48c979b

Please sign in to comment.