Skip to content

Commit

Permalink
fix: don't call setup twice
Browse files Browse the repository at this point in the history
  • Loading branch information
stringhandler committed Aug 7, 2024
1 parent c8506e1 commit 81cddfe
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
1 change: 1 addition & 0 deletions dist-isolation/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
window.__TAURI_ISOLATION_HOOK__ = (payload) => {
console.log("Isolation hook called with payload:", payload);
// TODO: Prevent command execution
// TODO: Perhaps whitelist commands
return payload
Expand Down
2 changes: 2 additions & 0 deletions src-tauri/src/binary_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ impl LatestVersionApiAdapter for GithubReleasesAdapter {
name_suffix = "linux-x86_64.zip";
}

info!(target: LOG_TARGET, "Looking for platform with suffix: {}", name_suffix);

let platform = version
.assets
.iter()
Expand Down
41 changes: 21 additions & 20 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import './theme/theme.css';
import { useEffect, useRef } from 'react';
import { invoke } from '@tauri-apps/api/tauri';
import {useEffect, useRef} from 'react';
import {invoke} from '@tauri-apps/api/tauri';
import CssBaseline from '@mui/material/CssBaseline';
import { ThemeProvider } from '@mui/material/styles';
import { lightTheme } from './theme/themes';
import { ContainerInner, DashboardContainer } from './theme/styles';
import { SideBar } from './containers/SideBar';
import { Dashboard } from './containers/Dashboard';
import { TitleBar } from './containers/TitleBar';
import { AppBackground } from './containers/AppBackground';
import {ThemeProvider} from '@mui/material/styles';
import {lightTheme} from './theme/themes';
import {ContainerInner, DashboardContainer} from './theme/styles';
import {SideBar} from './containers/SideBar';
import {Dashboard} from './containers/Dashboard';
import {TitleBar} from './containers/TitleBar';
import {AppBackground} from './containers/AppBackground';
import ErrorSnackbar from './containers/Error/ErrorSnackbar';
import { useUIStore } from './store/useUIStore.ts';
import { useGetStatus } from './hooks/useGetStatus.ts';
import { listen } from '@tauri-apps/api/event';
import { TauriEvent } from './types.ts';
import {useUIStore} from './store/useUIStore.ts';
import {useGetStatus} from './hooks/useGetStatus.ts';
import {listen} from '@tauri-apps/api/event';
import {TauriEvent} from './types.ts';
import useAppStateStore from './store/appStateStore.ts';

function App() {
Expand All @@ -26,7 +26,7 @@ function App() {
useEffect(() => {
const unlistenPromise = listen(
'message',
({ event, payload }: TauriEvent) => {
({event, payload}: TauriEvent) => {
console.log('Event:', event, payload);
switch (payload.event_type) {
case 'setup_status':
Expand All @@ -45,9 +45,10 @@ function App() {
}
);
if (!startupInitiated.current) {
startupInitiated.current = true;
invoke('setup_application').then((r) => {
console.log(r);
startupInitiated.current = true;

});
}

Expand All @@ -60,17 +61,17 @@ function App() {

return (
<ThemeProvider theme={lightTheme}>
<CssBaseline enableColorScheme />
<CssBaseline enableColorScheme/>
<AppBackground status={background}>
<DashboardContainer>
<TitleBar />
<TitleBar/>
<ContainerInner>
<SideBar />
<Dashboard status={view} />
<SideBar/>
<Dashboard status={view}/>
</ContainerInner>
</DashboardContainer>
</AppBackground>
<ErrorSnackbar />
<ErrorSnackbar/>
</ThemeProvider>
);
}
Expand Down

0 comments on commit 81cddfe

Please sign in to comment.