Skip to content

Commit a31f8aa

Browse files
committed
fix: removed the control on handleMouseUp that could be the cause of the phoneIsland bug that remains tied to mouse movement
improved FPS of moving phoneisland added 5s timeout on axios
1 parent 5339267 commit a31f8aa

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

src/main/classes/controllers/NetworkController.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export class NetworkController {
88

99
async post(path: string, data: object | undefined, config: { headers: { Authorization?: string | undefined; 'Content-Type': string; }; } | undefined = { headers: { 'Content-Type': 'application/json' } }): Promise<any> {
1010
try {
11-
const response = await axios.post(path, data, config)
11+
const response = await axios.post(path, data, {
12+
timeout: 5000,
13+
...config
14+
})
1215

1316
return response.data
1417
} catch (e: any) {
@@ -19,7 +22,10 @@ export class NetworkController {
1922
}
2023
async get(path: string, config: { headers: { Authorization?: string | undefined; 'Content-Type': string } } | undefined = { headers: { 'Content-Type': 'application/json' } }): Promise<any> {
2124
try {
22-
const response = await axios.get(path, config)
25+
const response = await axios.get(path, {
26+
timeout: 5000,
27+
...config
28+
})
2329
return response.data
2430
} catch (e: any) {
2531
const err: AxiosError = e

src/main/lib/ipcEvents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export function registerIpcEvents() {
104104
if (!draggingWindows?.hasOwnProperty(window.title)) {
105105
const interval: number = setInterval(() => {
106106
updateWindowPosition(window)
107-
}, 1000 / 60) as unknown as number; // => 60 frames per seconds
107+
}, 1000 / 300) as unknown as number; // => 300 frames per seconds
108108
draggingWindows = {
109109
...draggingWindows,
110110
[window.title]: {

src/renderer/src/components/ElectronDraggableWindow.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,10 @@ export const ElectronDraggableWindow = ({ children }) => {
3939
};
4040

4141
const handleMouseUp = (e: MouseEvent) => {
42-
if (!mouseUpEvent.current) {
43-
mouseDownEvent.current = null
44-
window.electron.send(IPC_EVENTS.STOP_DRAG);
45-
isDrag.current = false
46-
mouseUpEvent.current = e
47-
}
42+
mouseDownEvent.current = null
43+
window.electron.send(IPC_EVENTS.STOP_DRAG);
44+
isDrag.current = false
45+
mouseUpEvent.current = e
4846
};
4947

5048
useEffect(() => {

0 commit comments

Comments
 (0)