-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CHE-7040: Add 400 ms. delay in Navigate to file dialog #8177
Conversation
() -> Log.error(getClass(), "Project search request failed due timeout")); | ||
} | ||
}; | ||
timer.schedule(500); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
ci-test |
ci-test build report: |
@@ -39,12 +39,16 @@ | |||
@Singleton | |||
public class NavigateToFilePresenter implements NavigateToFileView.ActionDelegate { | |||
|
|||
private static final int TYPING_PERIOD_DELAY_MS = 400; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me TYPING_REQUEST_DELAY_MS
is clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not a request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not a query. The idea is to identify that typing is not finished yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see
} | ||
|
||
private void prepareResults(ProjectSearchResponseDto response) { | ||
List<SearchResultDto> results = response.getItemReferences(); | ||
sort( | ||
results, | ||
results.sort( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be better to create static comparator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
delegate.onFileNameChanged(fileName.getText()); | ||
String fileName = NavigateToFileViewImpl.this.fileName.getText(); | ||
// Skip handling non letter characters. | ||
if (nativeKeyCode == KEY_BACKSPACE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can check it before timer creation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/eclipse/che/blob/21e4f80341657048f1d6502792d1d642774d6377/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/navigation/NavigateToFileViewImpl.java#L335-L336
I am not sure that the file name field will be ready to give text.
ci-test |
ci-test build report: |
What does this PR do?
Add 400 ms. delay in the Navigate to file dialog. This prevents sending request to server if the file name field was updated during the timeout. Timeout in 500 ms. was chosen because It is enough to type a new symbol when typing a file name, and on the other hand this is not a big delay between end of typing and sending a request.
What issues does this PR fix or reference?
#7040
Prevent sending search request to server from Navigate to file dialog, if the file name field was updated.
Release Notes
N/A
Docs PR
N/A