Skip to content

Commit 99c5055

Browse files
committed
fix floating promises
1 parent d43a710 commit 99c5055

File tree

9 files changed

+36
-36
lines changed

9 files changed

+36
-36
lines changed

photon-client/src/components/app/photon-3d-visualizer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ const resetCamThirdPerson = () => {
151151
};
152152
153153
// async for lazy loading
154-
// eslint-disable-next-line @typescript-eslint/require-await
154+
155155
onMounted(async () => {
156156
scene = new Scene();
157157
camera = new PerspectiveCamera(75, 800 / 800, 0.1, 1000);
@@ -215,7 +215,7 @@ onMounted(async () => {
215215
renderer.render(scene, camera);
216216
};
217217
218-
drawTargets(props.targets);
218+
await drawTargets(props.targets);
219219
animate();
220220
});
221221
onBeforeUnmount(() => {

photon-client/src/components/app/photon-calibration-visualizer.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ const resetCamThirdPerson = () => {
202202
let animationFrameId: number | null = null;
203203
204204
// async for lazy loading
205-
// eslint-disable-next-line @typescript-eslint/require-await
205+
206206
onMounted(async () => {
207207
// Grab data first off
208-
fetchCalibrationData();
208+
await fetchCalibrationData();
209209
210210
scene = new Scene();
211211
camera = new PerspectiveCamera(75, 800 / 800, 0.1, 1000);
@@ -329,7 +329,7 @@ if (import.meta.hot) {
329329
}
330330
331331
watchEffect(() => {
332-
drawCalibration(calibrationData.value);
332+
void drawCalibration(calibrationData.value);
333333
});
334334
335335
watch(
@@ -339,9 +339,9 @@ watch(
339339
props.resolution.height,
340340
useCameraSettingsStore().getCalibrationCoeffs(props.resolution)
341341
],
342-
() => {
342+
async () => {
343343
console.log("Camera or resolution changed, refetching calibration");
344-
fetchCalibrationData();
344+
await fetchCalibrationData();
345345
}
346346
);
347347
</script>

photon-client/src/components/app/photon-camera-stream.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ const handleCaptureClick = () => {
6868
const handlePopoutClick = () => {
6969
window.open(streamSrc.value);
7070
};
71-
const handleFullscreenRequest = () => {
71+
const handleFullscreenRequest = async () => {
7272
const stream = document.getElementById(props.id);
7373
if (!stream) return;
74-
stream.requestFullscreen();
74+
await stream.requestFullscreen();
7575
};
7676
7777
const mjpgStream = ref<HTMLImageElement | null>(null);

photon-client/src/components/cameras/CameraCalibrationInfoCard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ const props = defineProps<{
1515
1616
const confirmRemoveDialog = ref({ show: false, vf: props.videoFormat });
1717
18-
const removeCalibration = (vf: VideoFormat) => {
19-
axiosPost("/calibration/remove", "delete a camera calibration", {
18+
const removeCalibration = async (vf: VideoFormat) => {
19+
await axiosPost("/calibration/remove", "delete a camera calibration", {
2020
cameraUniqueName: useCameraSettingsStore().currentCameraSettings.uniqueName,
2121
width: vf.resolution.width,
2222
height: vf.resolution.height

photon-client/src/components/cameras/CameraSettingsCard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ watchEffect(() => {
123123
});
124124
125125
const showDeleteCamera = ref(false);
126-
const deleteThisCamera = () => {
127-
axiosPost("/utils/nukeOneCamera", "delete this camera", {
126+
const deleteThisCamera = async () => {
127+
await axiosPost("/utils/nukeOneCamera", "delete this camera", {
128128
cameraUniqueName: useStateStore().currentCameraUniqueName
129129
});
130130
};

photon-client/src/components/settings/DeviceCard.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ const theme = useTheme();
1515
1616
const restartProgram = async () => {
1717
if (await axiosPost("/utils/restartProgram", "restart PhotonVision")) {
18-
forceReloadPage();
18+
await forceReloadPage();
1919
}
2020
};
2121
const restartDevice = async () => {
2222
if (await axiosPost("/utils/restartDevice", "restart the device")) {
23-
forceReloadPage();
23+
await forceReloadPage();
2424
}
2525
};
2626
@@ -36,7 +36,7 @@ const majorVersionRegex = new RegExp("(?:dev-)?(\\d+)\\.\\d+\\.\\d+");
3636
3737
const offlineUpdateDialog = ref({ show: false, confirmString: "" });
3838
39-
const handleOfflineUpdateRequest = () => {
39+
const handleOfflineUpdateRequest = async () => {
4040
const files = offlineUpdate.value?.files;
4141
if (!files) return;
4242
if (files.length === 0) return;
@@ -69,7 +69,7 @@ const handleOfflineUpdateRequest = () => {
6969
});
7070
return;
7171
} else if (versionMatch && !dev) {
72-
handleOfflineUpdate(files[0]);
72+
await handleOfflineUpdate(files[0]);
7373
} else if (!versionMatch && !dev) {
7474
offlineUpdateDialog.value = {
7575
show: true,
@@ -119,7 +119,7 @@ const handleOfflineUpdate = async (file: File) => {
119119
color: "secondary",
120120
timeout: -1
121121
});
122-
forceReloadPage();
122+
await forceReloadPage();
123123
}
124124
};
125125
@@ -145,7 +145,7 @@ const showImportDialog = ref(false);
145145
const importType = ref<ImportType | undefined>(undefined);
146146
const importFile = ref<File | null>(null);
147147
148-
const handleSettingsImport = () => {
148+
const handleSettingsImport = async () => {
149149
if (importType.value === undefined || importFile.value === null) return;
150150
const formData = new FormData();
151151
formData.append("data", importFile.value);
@@ -168,7 +168,7 @@ const handleSettingsImport = () => {
168168
settingsEndpoint = "";
169169
break;
170170
}
171-
axiosPost(`/settings${settingsEndpoint}`, "import settings", formData, {
171+
await axiosPost(`/settings${settingsEndpoint}`, "import settings", formData, {
172172
headers: { "Content-Type": "multipart/form-data" }
173173
});
174174
showImportDialog.value = false;
@@ -179,7 +179,7 @@ const handleSettingsImport = () => {
179179
const showFactoryReset = ref(false);
180180
const nukePhotonConfigDirectory = async () => {
181181
if (await axiosPost("/utils/nukeConfigDirectory", "delete the config directory")) {
182-
forceReloadPage();
182+
await forceReloadPage();
183183
}
184184
};
185185

photon-client/src/components/settings/ObjectDetectionCard.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,20 @@ const handleImport = async () => {
7474
importVersion.value = null;
7575
};
7676
77-
const deleteModel = (model: ObjectDetectionModelProperties) => {
78-
axiosPost("/objectdetection/delete", "delete an object detection model", {
77+
const deleteModel = async (model: ObjectDetectionModelProperties) => {
78+
await axiosPost("/objectdetection/delete", "delete an object detection model", {
7979
modelPath: model.modelPath
8080
});
8181
};
8282
83-
const renameModel = (model: ObjectDetectionModelProperties, newName: string) => {
83+
const renameModel = async (model: ObjectDetectionModelProperties, newName: string) => {
8484
useStateStore().showSnackbarMessage({
8585
message: "Renaming Object Detection Model...",
8686
color: "secondary",
8787
timeout: -1
8888
});
8989
90-
axiosPost("/objectdetection/rename", "rename an object detection model", {
90+
await axiosPost("/objectdetection/rename", "rename an object detection model", {
9191
modelPath: model.modelPath,
9292
newName: newName
9393
});
@@ -117,8 +117,8 @@ const openExportIndividualModelPrompt = () => {
117117
};
118118
119119
const showNukeDialog = ref(false);
120-
const nukeModels = () => {
121-
axiosPost("/objectdetection/nuke", "clear and reset object detection models");
120+
const nukeModels = async () => {
121+
await axiosPost("/objectdetection/nuke", "clear and reset object detection models");
122122
};
123123
124124
const showBulkImportDialog = ref(false);

photon-client/src/plugins/vuetify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import "vuetify/styles";
2-
import("@mdi/font/css/materialdesignicons.css");
2+
import "@mdi/font/css/materialdesignicons.css";
33
import type { ThemeDefinition } from "vuetify";
44
import { createVuetify } from "vuetify";
55

photon-client/src/views/CameraMatchingView.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,45 @@ const backendHostname = inject<string>("backendHostname", "localhost");
1616
const formatUrl = (port: number) => `http://${backendHostname}:${port}/stream.mjpg`;
1717
1818
const activatingModule = ref(false);
19-
const activateModule = (moduleUniqueName: string) => {
19+
const activateModule = async (moduleUniqueName: string) => {
2020
if (activatingModule.value) return;
2121
activatingModule.value = true;
2222
23-
axiosPost("/utils/activateMatchedCamera", "activate a matched camera", {
23+
await axiosPost("/utils/activateMatchedCamera", "activate a matched camera", {
2424
cameraUniqueName: moduleUniqueName
2525
}).finally(() => (activatingModule.value = false));
2626
};
2727
2828
const assigningCamera = ref(false);
29-
const assignCamera = (cameraInfo: PVCameraInfo) => {
29+
const assignCamera = async (cameraInfo: PVCameraInfo) => {
3030
if (assigningCamera.value) return;
3131
assigningCamera.value = true;
3232
3333
const payload = {
3434
cameraInfo: cameraInfo
3535
};
3636
37-
axiosPost("/utils/assignUnmatchedCamera", "assign an unmatched camera", payload).finally(
37+
await axiosPost("/utils/assignUnmatchedCamera", "assign an unmatched camera", payload).finally(
3838
() => (assigningCamera.value = false)
3939
);
4040
};
4141
4242
const deactivatingModule = ref(false);
43-
const deactivateModule = (cameraUniqueName: string) => {
43+
const deactivateModule = async (cameraUniqueName: string) => {
4444
if (deactivatingModule.value) return;
4545
deactivatingModule.value = true;
46-
axiosPost("/utils/unassignCamera", "unassign a camera", { cameraUniqueName: cameraUniqueName }).finally(
46+
await axiosPost("/utils/unassignCamera", "unassign a camera", { cameraUniqueName: cameraUniqueName }).finally(
4747
() => (deactivatingModule.value = false)
4848
);
4949
};
5050
5151
const confirmDeleteDialog = ref({ show: false, nickname: "", cameraUniqueName: "" });
5252
const deletingCamera = ref<string | null>(null);
5353
54-
const deleteThisCamera = (cameraUniqueName: string) => {
54+
const deleteThisCamera = async (cameraUniqueName: string) => {
5555
if (deletingCamera.value) return;
5656
deletingCamera.value = cameraUniqueName;
57-
axiosPost("/utils/nukeOneCamera", "delete a camera", { cameraUniqueName: cameraUniqueName }).finally(() => {
57+
await axiosPost("/utils/nukeOneCamera", "delete a camera", { cameraUniqueName: cameraUniqueName }).finally(() => {
5858
deletingCamera.value = null;
5959
});
6060
};

0 commit comments

Comments
 (0)