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 'overlayscrollbars/overlayscrollbars.css';
|
||||||
import 'virtual:uno.css';
|
import 'virtual:uno.css';
|
||||||
import './globals.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 BrowserRoot from '~ui/pages/browser/BrowserRoot';
|
||||||
import { initAppInfo } from '~utils/program-info';
|
import { initAppInfo } from '~utils/program-info';
|
||||||
|
|
||||||
export * as bridge from './bindings';
|
(async () => {
|
||||||
|
await initAppInfo();
|
||||||
initAppInfo()
|
render(() => (
|
||||||
.then(() => {
|
<Router root={App}>
|
||||||
render(() => (
|
<Route path="/" component={HomePage} />
|
||||||
<Router root={App}>
|
<Route path="/updates" component={UpdatesPage} />
|
||||||
<Route path="/" component={HomePage} />
|
<Route path="/clusters" component={ClusterRoot} children={<ClusterRoot.Routes />} />
|
||||||
<Route path="/updates" component={UpdatesPage} />
|
<Route path="/settings" component={SettingsRoot} children={<SettingsRoot.Routes />} />
|
||||||
<Route path="/clusters" component={ClusterRoot} children={<ClusterRoot.Routes />} />
|
<Route path="/browser" component={BrowserRoot} children={<BrowserRoot.Routes />} />
|
||||||
<Route path="/settings" component={SettingsRoot} children={<SettingsRoot.Routes />} />
|
</Router>
|
||||||
<Route path="/browser" component={BrowserRoot} children={<BrowserRoot.Routes />} />
|
), document.getElementById('root') as HTMLElement);
|
||||||
</Router>
|
})();
|
||||||
), document.getElementById('root') as HTMLElement);
|
|
||||||
});
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { type Context, type ParentProps, type Resource, Show, createContext, useContext } from 'solid-js';
|
import { type Context, type ParentProps, type Resource, Show, createContext, useContext } from 'solid-js';
|
||||||
import useCommand from './useCommand';
|
import useCommand from './useCommand';
|
||||||
import type { Cluster } from '~bindings';
|
import type { Cluster } from '~bindings';
|
||||||
import { bridge } from '~index';
|
import { bridge } from '~imports';
|
||||||
|
|
||||||
const ClusterContext = createContext<Cluster>() as Context<Cluster>;
|
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 { type Context, type ParentProps, type Resource, Show, createContext, createEffect, useContext } from 'solid-js';
|
||||||
import useCommand from './useCommand';
|
import useCommand from './useCommand';
|
||||||
import type { Settings } from '~bindings';
|
import type { Settings } from '~bindings';
|
||||||
import { bridge } from '~index';
|
import { bridge } from '~imports';
|
||||||
|
|
||||||
const SettingsContext = createContext<Settings>() as Context<Settings>;
|
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 ClusterCover from '~ui/components/game/ClusterCover';
|
||||||
import type { Cluster } from '~bindings';
|
import type { Cluster } from '~bindings';
|
||||||
import useCommand from '~ui/hooks/useCommand';
|
import useCommand from '~ui/hooks/useCommand';
|
||||||
import { bridge } from '~index';
|
import { bridge } from '~imports';
|
||||||
import { upperFirst } from '~utils/string';
|
import { upperFirst } from '~utils/string';
|
||||||
|
|
||||||
// TODO: Replace this into it's own component
|
// TODO: Replace this into it's own component
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ import SettingsChangelog from './about/SettingsChangelog';
|
||||||
import AnimatedRoutes from '~ui/components/AnimatedRoutes';
|
import AnimatedRoutes from '~ui/components/AnimatedRoutes';
|
||||||
import ErrorBoundary from '~ui/components/ErrorBoundary';
|
import ErrorBoundary from '~ui/components/ErrorBoundary';
|
||||||
import Tooltip from '~ui/components/base/Tooltip';
|
import Tooltip from '~ui/components/base/Tooltip';
|
||||||
import { bridge } from '~index';
|
|
||||||
import useCommand from '~ui/hooks/useCommand';
|
|
||||||
import { AppInfo } from '~utils/program-info';
|
import { AppInfo } from '~utils/program-info';
|
||||||
|
|
||||||
function SettingsRoutes() {
|
function SettingsRoutes() {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,23 @@
|
||||||
import type { ProgramInfo } from '~bindings';
|
import type { ProgramInfo } from '~bindings';
|
||||||
import { bridge } from '~index';
|
import { bridge } from '~imports';
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-mutable-exports -- because yes
|
// 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 default AppInfo;
|
||||||
|
|
||||||
export async function initAppInfo() {
|
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