Skip to content

Commit 3bc7167

Browse files
committed
Revert "feat: add refresh functionality to device management components"
This reverts commit ea94556.
1 parent ea94556 commit 3bc7167

File tree

4 files changed

+2
-28
lines changed

4 files changed

+2
-28
lines changed

website/src/AppState.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff 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

3729
export const AppState = new GlobalAppState();

website/src/components/Devices.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff 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
}

website/src/components/ImportExportDelete.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ import { grpc } from '../Api';
1010
import { toast } from './Toast';
1111
import { 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
}

website/src/components/Navigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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 />

0 commit comments

Comments
 (0)