File tree Expand file tree Collapse file tree 4 files changed +2
-28
lines changed
Expand file tree Collapse file tree 4 files changed +2
-28
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,12 @@ class GlobalAppState {
55 info ?: InfoRes . AsObject ;
66 loadingError ?: String ;
77 darkMode : boolean ;
8- refreshDevices ?: ( ) => void ;
98
109 constructor ( ) {
1110 makeObservable ( this , {
1211 info : observable ,
1312 darkMode : observable ,
1413 loadingError : observable ,
15- refreshDevices : observable ,
1614 } ) ;
1715
1816 const prefersDarkMode = window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches ;
@@ -26,12 +24,6 @@ class GlobalAppState {
2624 this . darkMode = darkMode ;
2725 } ) ;
2826 }
29-
30- setRefreshDevices ( refreshFn : ( ) => void ) {
31- runInAction ( ( ) => {
32- this . refreshDevices = refreshFn ;
33- } ) ;
34- }
3527}
3628
3729export const AppState = new GlobalAppState ( ) ;
Original file line number Diff line number Diff line change @@ -34,11 +34,6 @@ export const Devices = observer(
3434 } ) ;
3535 }
3636
37- componentDidMount ( ) {
38- // Register the refresh function with the AppState
39- AppState . setRefreshDevices ( ( ) => this . devices . refresh ( ) ) ;
40- }
41-
4237 componentWillUnmount ( ) {
4338 this . devices . dispose ( ) ;
4439 }
Original file line number Diff line number Diff line change @@ -10,11 +10,8 @@ import { grpc } from '../Api';
1010import { toast } from './Toast' ;
1111import { confirm } from './Present' ;
1212
13- interface Props {
14- onRefresh ?: ( ) => void ;
15- }
1613
17- export function ImportExportDelete ( { onRefresh } : Props ) {
14+ export function ImportExportDelete ( ) {
1815 const handleExport = async ( ) => {
1916 try {
2017 const response = await grpc . devices . listDevices ( { } ) ;
@@ -58,11 +55,6 @@ export function ImportExportDelete({ onRefresh }: Props) {
5855 }
5956
6057 toast ( { text : 'Devices imported successfully' , intent : 'success' } ) ;
61-
62- // Trigger refresh after successful import
63- if ( onRefresh ) {
64- onRefresh ( ) ;
65- }
6658 } catch ( error ) {
6759 toast ( { text : 'Failed to import devices: ' + ( error as Error ) . message , intent : 'error' } ) ;
6860 }
@@ -81,11 +73,6 @@ export function ImportExportDelete({ onRefresh }: Props) {
8173 }
8274
8375 toast ( { text : 'All devices deleted successfully' , intent : 'success' } ) ;
84-
85- // Trigger refresh after successful deletion
86- if ( onRefresh ) {
87- onRefresh ( ) ;
88- }
8976 } catch ( error ) {
9077 toast ( { text : 'Failed to delete devices: ' + ( error as Error ) . message , intent : 'error' } ) ;
9178 }
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ export default function Navigation() {
6161
6262 { hasAuthCookie ? (
6363 < >
64- < ImportExportDelete onRefresh = { AppState . refreshDevices } />
64+ < ImportExportDelete />
6565 < Link href = "/signout" color = "inherit" >
6666 < IconButton sx = { { ml : 1 } } color = "inherit" title = "Logout" >
6767 < LogoutIcon />
You can’t perform that action at this time.
0 commit comments