Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

[Bug] data is sent multiple times #76

Closed
hmf opened this issue Apr 22, 2020 · 5 comments
Closed

[Bug] data is sent multiple times #76

hmf opened this issue Apr 22, 2020 · 5 comments
Labels
bug Something isn't working

Comments

@hmf
Copy link

hmf commented Apr 22, 2020

Describe the bug
I used the MathPix dashboard to check on my information and observed more recorded requests than I had done.

To Reproduce
Steps to reproduce the behavior:

  1. Launched the application
  2. Took a screen shot
  3. Used return to send the request
  4. Received response
  5. Went to the dashboard and observed an extra request

Expected behavior
I expected one message per button press.

Desktop (please complete the following information):

  • OS: Ubuntu Linux
  • Version 18.04

Additional context
I changed the code and added println to confirm what was happening.
The message was in fact sent twice. I then confirmed that no press de-bounce
code was present in the Java code.

I have added de-bounce to the BackGridPaneclass here.

I also added additional changes to the accepted keys:

  • insert to do the same as backspace
  • delete to do the same as enter

The reason is that the enter will only work if one of the text fields have focus.
However the delete is always detected (like the backspace) and allows us
to forego the selection of a text field.

If you like, I can make a pull request with these changes.

@hmf hmf added the bug Something isn't working label Apr 22, 2020
@blaisewang
Copy link
Owner

blaisewang commented Apr 22, 2020

Hi, the data was sent to two APIs for different purposes. v3/text API was queried for advanced features, such as paragraph OCR, basic table OCR, MathML result, TSV result, and more. v3/latex was queried for rendering the results. Sending two requests was introduced in v0.6.0.

In the second latest version v0.7.3, the legacy v3/latex API was removed. The cost of removing this API is the user cannot view some rendered result (only equations will be rendered), they need to paste the result into a LaTeX editor before they can view the results.

With removing the legacy API, each data will be sent once now.

I got a few issue reports about the key listening problem. I cannot explain why but indeed sometimes the key listening just doesn't work no matter which key you chose. In fact, the reason why I chose Backspace for preview is I got a report saying that the Space key doesn't work. You may try the latest version in this repo (v0.7.4) to see if it's working or not.

@blaisewang
Copy link
Owner

In theory, all key listening should work. If you wish, you may try to figure out why sometimes some key just doesn't work. Eventually, I would still like to use the Space key for preview screenshot and the Enter key for making OCR requests.

@hmf
Copy link
Author

hmf commented Apr 22, 2020

If I understand correctly the latest master version is not using the legacy v3/latex API. If so then only one request is made. I think I am using the latest master. However, note that I debugged the system, so I am pretty sure several key strokes are processed sequentially. It is the same issue you dealt with in the case o the backspace - only their you use a timer.

@hmf
Copy link
Author

hmf commented Apr 22, 2020

Some keys are only processed by some JavaFX nodes. The top tier nodes don't. Text fields do. Maybe the issue with space is the same. Try and set focus on one of the text fields and then press space. Maybe setting the focus automatically will solve your problem. HTH.

@hmf hmf closed this as completed Apr 22, 2020
@blaisewang
Copy link
Owner

Good thought.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants