Browse Source
* fix: make tunnels work in multi-instance scenarios * factor tunnels out * use tunnel-rat fork until upsteam updatedpull/6181/head
12 changed files with 76 additions and 32 deletions
@ -0,0 +1,32 @@ |
|||||||
|
import React from "react"; |
||||||
|
import tunnel from "@dwelle/tunnel-rat"; |
||||||
|
|
||||||
|
type Tunnel = ReturnType<typeof tunnel>; |
||||||
|
|
||||||
|
type TunnelsContextValue = { |
||||||
|
mainMenuTunnel: Tunnel; |
||||||
|
welcomeScreenMenuHintTunnel: Tunnel; |
||||||
|
welcomeScreenToolbarHintTunnel: Tunnel; |
||||||
|
welcomeScreenHelpHintTunnel: Tunnel; |
||||||
|
welcomeScreenCenterTunnel: Tunnel; |
||||||
|
footerCenterTunnel: Tunnel; |
||||||
|
jotaiScope: symbol; |
||||||
|
}; |
||||||
|
|
||||||
|
export const TunnelsContext = React.createContext<TunnelsContextValue>(null!); |
||||||
|
|
||||||
|
export const useTunnels = () => React.useContext(TunnelsContext); |
||||||
|
|
||||||
|
export const useInitializeTunnels = () => { |
||||||
|
return React.useMemo((): TunnelsContextValue => { |
||||||
|
return { |
||||||
|
mainMenuTunnel: tunnel(), |
||||||
|
welcomeScreenMenuHintTunnel: tunnel(), |
||||||
|
welcomeScreenToolbarHintTunnel: tunnel(), |
||||||
|
welcomeScreenHelpHintTunnel: tunnel(), |
||||||
|
welcomeScreenCenterTunnel: tunnel(), |
||||||
|
footerCenterTunnel: tunnel(), |
||||||
|
jotaiScope: Symbol(), |
||||||
|
}; |
||||||
|
}, []); |
||||||
|
}; |
||||||
@ -1,8 +0,0 @@ |
|||||||
import tunnel from "tunnel-rat"; |
|
||||||
|
|
||||||
export const mainMenuTunnel = tunnel(); |
|
||||||
export const welcomeScreenMenuHintTunnel = tunnel(); |
|
||||||
export const welcomeScreenToolbarHintTunnel = tunnel(); |
|
||||||
export const welcomeScreenHelpHintTunnel = tunnel(); |
|
||||||
export const welcomeScreenCenterTunnel = tunnel(); |
|
||||||
export const footerCenterTunnel = tunnel(); |
|
||||||
Loading…
Reference in new issue