Skip to content
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

Copy doesn't work on first hotkey stroke #437

Closed
bhajneet opened this issue Feb 24, 2020 · 13 comments · Fixed by #573
Closed

Copy doesn't work on first hotkey stroke #437

bhajneet opened this issue Feb 24, 2020 · 13 comments · Fixed by #573
Assignees
Labels
Effort 5 Chunky! Ensure this is the smallest that it can be split to before committing to it. Impacts Some Affects the average end-user. Scope: Frontend/Controller ○ Type Bug Regressions/production issues that do not function as intended.

Comments

@bhajneet
Copy link
Member

It felt as though the copy function wasn't working the first time every once in a while. Reported by two users.

@bhajneet bhajneet added ○ Type Bug Regressions/production issues that do not function as intended. Status: In Research Impacts Some Affects the average end-user. Scope: Frontend/Controller labels Feb 24, 2020
@preetcharan
Copy link

only works on second stroke for me on mac ver 2.5.0

@Harjot1Singh Harjot1Singh added the Effort 5 Chunky! Ensure this is the smallest that it can be split to before committing to it. label Feb 28, 2020
@bhajneet
Copy link
Member Author

bhajneet commented May 4, 2020

Confirmed first hotkey stroke shows "copied" pop-up, but pasting elsewhere does not concur

@bhajneet bhajneet changed the title Confirm whether copied on first hotkey stroke or not Copy doesn't work on first hotkey stroke May 4, 2020
@bhajneet bhajneet assigned saihaj and unassigned Harjot1Singh May 4, 2020
@bhajneet
Copy link
Member Author

Confirmed not working on 176-customizable-hotkeys.

Reproduce:

  1. Start new instance of Shabad OS
  2. Search a shabad and open it in navigator
  3. Use copy hotkey sequence
  4. Notice the pop up that says it's copied
  5. Try to paste, but does not show what was supposedly copied

@saihaj
Copy link
Member

saihaj commented May 27, 2020

@Harjot1Singh how can I get started?

@Harjot1Singh
Copy link
Member

@Harjot1Singh how can I get started?

You're going to want to check if the handler is just not being fired the first time at all to start with. If it's not, find out why. It could be a race-condition or render issue. Test to see if it's any better when you supply a hardcoded keymap and handlers. There are a couple of components which handle different hotkeys, but copy hotkeys are handled in CopyHotkeys.js

@saihaj
Copy link
Member

saihaj commented May 28, 2020

In browser, this is not an issue. So this has to do something with Electron.

@saihaj
Copy link
Member

saihaj commented May 28, 2020

@Harjot1Singh what should I do. Because if it was a render issue then it should exist in browser too (Or my assumption is wrong?)

@Harjot1Singh
Copy link
Member

Do some console logging to confirm whether the handler is firing or not.

@bhajneet
Copy link
Member Author

bhajneet commented Jun 1, 2020

I have noticed that in production release if you change shabads it again fails to register the first copy hotkey.

@saihaj
Copy link
Member

saihaj commented Jun 1, 2020

Do some console logging to confirm whether the handler is firing or not.

I modified this reducer shared/CopyHotkeys.js to log. So it is returning the line that I am currently at and that is expected. But the state of useCopyToClipboard hook is not updating. Something wrong with the hook?

...

].reduce( ( hotkeys, [ name, getContent, fieldName ] ) => ( {
    ...hotkeys,
    [ name ]: () => {
      console.log( getContent() )
      copyToClipboard( line && getContent(), `No ${fieldName} available to copy` )
    },
  } ), {} )

...

@saihaj
Copy link
Member

saihaj commented Jun 1, 2020

Something wrong with the hook?

So I logged the hook to see what is being passed to it and correct text is being passed down. Now it is all on copy-to-clipboard that handles copying.

@saihaj
Copy link
Member

saihaj commented Jun 1, 2020

I have noticed that in production release if you change shabads it again fails to register the first copy hotkey.

Does not work on dev

saihaj added a commit to saihaj/ShabadOSpresenter that referenced this issue Jun 1, 2020
@saihaj
Copy link
Member

saihaj commented Jun 1, 2020

#573 will temporarily fix this but an ideal solution is resolution of sudodoki/copy-to-clipboard#90

saihaj added a commit to saihaj/ShabadOSpresenter that referenced this issue Jun 1, 2020
A temporary fix shabados#437

refactor(frontend): comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Effort 5 Chunky! Ensure this is the smallest that it can be split to before committing to it. Impacts Some Affects the average end-user. Scope: Frontend/Controller ○ Type Bug Regressions/production issues that do not function as intended.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants