refactor: don't enable browser until we are ready
This commit is contained in:
parent
6f9bf3ac80
commit
b261d57f36
|
@ -102,7 +102,6 @@ async function boot(status: LumeStatusContextType, auth: AuthContextType) {
|
||||||
BOOT_FUNCTIONS.push(async () => await handshakeClient.register());
|
BOOT_FUNCTIONS.push(async () => await handshakeClient.register());
|
||||||
BOOT_FUNCTIONS.push(async () => await ethClient.register());
|
BOOT_FUNCTIONS.push(async () => await ethClient.register());
|
||||||
BOOT_FUNCTIONS.push(async () => await ipfsClient.register());
|
BOOT_FUNCTIONS.push(async () => await ipfsClient.register());
|
||||||
BOOT_FUNCTIONS.push(async () => status.setReady(true));
|
|
||||||
|
|
||||||
const resolvers = [
|
const resolvers = [
|
||||||
"zrjCnUBqmBqXXcc2yPnq517sXQtNcfZ2BHgnVTcbhSYxko7", // CID
|
"zrjCnUBqmBqXXcc2yPnq517sXQtNcfZ2BHgnVTcbhSYxko7", // CID
|
||||||
|
@ -113,6 +112,7 @@ async function boot(status: LumeStatusContextType, auth: AuthContextType) {
|
||||||
for (const resolver of resolvers) {
|
for (const resolver of resolvers) {
|
||||||
BOOT_FUNCTIONS.push(async () => dnsClient.registerResolver(resolver));
|
BOOT_FUNCTIONS.push(async () => dnsClient.registerResolver(resolver));
|
||||||
}
|
}
|
||||||
|
BOOT_FUNCTIONS.push(async () => status.setReady(true));
|
||||||
|
|
||||||
await bootup();
|
await bootup();
|
||||||
|
|
||||||
|
@ -132,8 +132,8 @@ async function bootup() {
|
||||||
|
|
||||||
export function Navigator() {
|
export function Navigator() {
|
||||||
const { url: contextUrl, setUrl } = useBrowserState();
|
const { url: contextUrl, setUrl } = useBrowserState();
|
||||||
const { isLoggedIn } = useAuth();
|
|
||||||
const [inputValue, setInputValue] = useState(contextUrl); // Local state for the input value
|
const [inputValue, setInputValue] = useState(contextUrl); // Local state for the input value
|
||||||
|
const { ready } = useLumeStatus();
|
||||||
|
|
||||||
const browse = () => {
|
const browse = () => {
|
||||||
let input = inputValue.trim();
|
let input = inputValue.trim();
|
||||||
|
@ -169,9 +169,9 @@ export function Navigator() {
|
||||||
<NavInput
|
<NavInput
|
||||||
value={inputValue}
|
value={inputValue}
|
||||||
onChange={(e: any) => setInputValue(e.target.value)}
|
onChange={(e: any) => setInputValue(e.target.value)}
|
||||||
disabled={!isLoggedIn}
|
disabled={!ready}
|
||||||
/>
|
/>
|
||||||
<Button onClick={browse} disabled={!isLoggedIn}>
|
<Button onClick={browse} disabled={!ready}>
|
||||||
Navigate
|
Navigate
|
||||||
<Arrow />
|
<Arrow />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
Loading…
Reference in New Issue