fix: HMR when saving index.ts file
This commit is contained in:
parent
82830d02ee
commit
7432f7cba9
7 changed files with 33 additions and 22 deletions
|
|
@ -6,3 +6,5 @@ import '@fontsource/poppins/600.css';
|
|||
import 'overlayscrollbars/overlayscrollbars.css';
|
||||
import 'virtual:uno.css';
|
||||
import './globals.css';
|
||||
|
||||
export * as bridge from './bindings';
|
||||
|
|
|
|||
|
|
@ -12,17 +12,15 @@ import SettingsRoot from '~ui/pages/settings/SettingsRoot';
|
|||
import BrowserRoot from '~ui/pages/browser/BrowserRoot';
|
||||
import { initAppInfo } from '~utils/program-info';
|
||||
|
||||
export * as bridge from './bindings';
|
||||
|
||||
initAppInfo()
|
||||
.then(() => {
|
||||
render(() => (
|
||||
<Router root={App}>
|
||||
<Route path="/" component={HomePage} />
|
||||
<Route path="/updates" component={UpdatesPage} />
|
||||
<Route path="/clusters" component={ClusterRoot} children={<ClusterRoot.Routes />} />
|
||||
<Route path="/settings" component={SettingsRoot} children={<SettingsRoot.Routes />} />
|
||||
<Route path="/browser" component={BrowserRoot} children={<BrowserRoot.Routes />} />
|
||||
</Router>
|
||||
), document.getElementById('root') as HTMLElement);
|
||||
});
|
||||
(async () => {
|
||||
await initAppInfo();
|
||||
render(() => (
|
||||
<Router root={App}>
|
||||
<Route path="/" component={HomePage} />
|
||||
<Route path="/updates" component={UpdatesPage} />
|
||||
<Route path="/clusters" component={ClusterRoot} children={<ClusterRoot.Routes />} />
|
||||
<Route path="/settings" component={SettingsRoot} children={<SettingsRoot.Routes />} />
|
||||
<Route path="/browser" component={BrowserRoot} children={<BrowserRoot.Routes />} />
|
||||
</Router>
|
||||
), document.getElementById('root') as HTMLElement);
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { type Context, type ParentProps, type Resource, Show, createContext, useContext } from 'solid-js';
|
||||
import useCommand from './useCommand';
|
||||
import type { Cluster } from '~bindings';
|
||||
import { bridge } from '~index';
|
||||
import { bridge } from '~imports';
|
||||
|
||||
const ClusterContext = createContext<Cluster>() as Context<Cluster>;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { type Context, type ParentProps, type Resource, Show, createContext, createEffect, useContext } from 'solid-js';
|
||||
import useCommand from './useCommand';
|
||||
import type { Settings } from '~bindings';
|
||||
import { bridge } from '~index';
|
||||
import { bridge } from '~imports';
|
||||
|
||||
const SettingsContext = createContext<Settings>() as Context<Settings>;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import TextField from '../components/base/TextField';
|
|||
import ClusterCover from '~ui/components/game/ClusterCover';
|
||||
import type { Cluster } from '~bindings';
|
||||
import useCommand from '~ui/hooks/useCommand';
|
||||
import { bridge } from '~index';
|
||||
import { bridge } from '~imports';
|
||||
import { upperFirst } from '~utils/string';
|
||||
|
||||
// TODO: Replace this into it's own component
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@ import SettingsChangelog from './about/SettingsChangelog';
|
|||
import AnimatedRoutes from '~ui/components/AnimatedRoutes';
|
||||
import ErrorBoundary from '~ui/components/ErrorBoundary';
|
||||
import Tooltip from '~ui/components/base/Tooltip';
|
||||
import { bridge } from '~index';
|
||||
import useCommand from '~ui/hooks/useCommand';
|
||||
import { AppInfo } from '~utils/program-info';
|
||||
|
||||
function SettingsRoutes() {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,23 @@
|
|||
import type { ProgramInfo } from '~bindings';
|
||||
import { bridge } from '~index';
|
||||
import { bridge } from '~imports';
|
||||
|
||||
// eslint-disable-next-line import/no-mutable-exports -- because yes
|
||||
export let AppInfo!: ProgramInfo;
|
||||
export let AppInfo: ProgramInfo = {
|
||||
launcher_version: 'err',
|
||||
tauri_version: 'err',
|
||||
webview_version: 'err',
|
||||
platform: 'err',
|
||||
arch: 'err',
|
||||
dev_build: false,
|
||||
};
|
||||
|
||||
export default AppInfo;
|
||||
|
||||
export async function initAppInfo() {
|
||||
AppInfo = await bridge.commands.getProgramInfo();
|
||||
try {
|
||||
AppInfo = await bridge.commands.getProgramInfo();
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue