Skip to content

Commit

Permalink
fix: injected extensions logic
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosala committed Aug 12, 2024
1 parent caf9b4a commit 620b797
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/context/extensionCtx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from "polkadot-api/pjs-signer"
import { createContext, useContext, useEffect, useMemo, useState } from "react"

const getJoinedInjectedExtensions = () => getInjectedExtensions()?.join(",")
const getJoinedInjectedExtensions = () => getInjectedExtensions().join(",")

export const useAvailableExtensions = (): string[] => {
const [extensions, setExtensions] = useState(getJoinedInjectedExtensions)
Expand All @@ -23,7 +23,10 @@ export const useAvailableExtensions = (): string[] => {
}
}, [])

return useMemo(() => extensions?.split(",") ?? [], [extensions])
return useMemo(
() => (extensions.length ? extensions.split(",") : []),
[extensions],
)
}

export const extensionCtx = createContext<InjectedExtension[]>([])
Expand Down

0 comments on commit 620b797

Please sign in to comment.