Skip to content

Commit 01ae41b

Browse files
authored
Increase the refresh interval, sometimes the request time will be > 300ms (#684)
<!-- Please provide brief information about the PR, what it contains & its purpose, new behaviors after the change. And let us know here if you need any help: https://github.com/microsoft/HydraLab/issues/new --> ## Description <!-- A few words to explain your changes --> ### Linked GitHub issue ID: # ## Pull Request Checklist <!-- Put an x in the boxes that apply. This is simply a reminder of what we are going to look for before merging your code. --> - [ ] Tests for the changes have been added (for bug fixes / features) - [x] Code compiles correctly with all tests are passed. - [x] I've read the [contributing guide](https://github.com/microsoft/HydraLab/blob/main/CONTRIBUTING.md#making-changes-to-the-code) and followed the recommended practices. - [ ] [Wikis](https://github.com/microsoft/HydraLab/wiki) or [README](https://github.com/microsoft/HydraLab/blob/main/README.md) have been reviewed and added / updated if needed (for bug fixes / features) ### Does this introduce a breaking change? *If this introduces a breaking change for Hydra Lab users, please describe the impact and migration path.* - [ ] Yes - [x] No ## How you tested it *Please make sure the change is tested, you can test it by adding UTs, do local test and share the screenshots, etc.* Please check the type of change your PR introduces: - [x] Bugfix - [ ] Feature - [ ] Technical design - [ ] Build related changes - [ ] Refactoring (no functional changes, no api changes) - [ ] Code style update (formatting, renaming) or Documentation content changes - [ ] Other (please describe): ### Feature UI screenshots or Technical design diagrams *If this is a relatively large or complex change, kick it off by drawing the tech design with PlantUML and explaining why you chose the solution you did and what alternatives you considered, etc...*
1 parent 8afb83d commit 01ae41b

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

react/src/component/DeviceDialog.jsx

+3-10
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ const DeviceDialog = ({ open, onClose, selectedDevice }) => {
9797
};
9898

9999
const handleSwipe = (e) => {
100-
debugger
101100
var startX = startPosition.x - e.target.getBoundingClientRect().left;
102101
var startY = startPosition.y - e.target.getBoundingClientRect().top;
103102
var endX = e.clientX - e.target.getBoundingClientRect().left;
@@ -130,11 +129,11 @@ const DeviceDialog = ({ open, onClose, selectedDevice }) => {
130129
const refreshImage = () => {
131130
const interval = setInterval(() => {
132131
setCount(prevCount => prevCount + 1);
133-
}, 300);
132+
}, 750);
134133

135134
setTimeout(() => {
136135
clearInterval(interval);
137-
}, 3000);
136+
}, 4000);
138137
}
139138

140139
const refreshDeviceScreen = () => {
@@ -145,13 +144,7 @@ const DeviceDialog = ({ open, onClose, selectedDevice }) => {
145144
axios.post('/api/device/operate', formParams, {
146145
headers: { 'content-type': 'application/json' }
147146
}).then(res => {
148-
const interval = setInterval(() => {
149-
setCount(prevCount => prevCount + 1);
150-
}, 300); // refresh every 0.3s
151-
152-
setTimeout(() => {
153-
clearInterval(interval);
154-
}, 3000); // stop after 3s
147+
refreshImage();
155148
})
156149
}
157150

0 commit comments

Comments
 (0)