Skip to content

Conversation

RayAsh37
Copy link
Contributor

Description

Pressing enter on confirmation modal deletes the entry even if cancel is focused. This PR is a possible fix

Related Issue(s)

Fixes #16717

@RayAsh37 RayAsh37 requested a review from a team April 22, 2023 07:34
@RayAsh37 RayAsh37 requested a review from gtsiolis as a code owner April 22, 2023 07:34
@RayAsh37
Copy link
Contributor Author

RayAsh37 commented Apr 22, 2023

Is there any way to locally run an instance of the front-end for debugging purposes?

Or can I preview the build for my branch?

@gtsiolis gtsiolis changed the base branch from main to gt/merge-17326 April 23, 2023 10:28
@roboquat roboquat added size/S and removed size/XS labels Apr 24, 2023
@RayAsh37
Copy link
Contributor Author

RayAsh37 commented Apr 24, 2023

Hey @gtsiolis , I am not entirely sure but I think I was able to catch the root cause. It was because of an incorrect forwarding of a useRef object. Here is the official react reference. Please review.

@RayAsh37 RayAsh37 changed the title Fix for #16717 Fix for workspace delete on Enter keydown Apr 24, 2023
minor typescript related cleanup regarding useRef
@RayAsh37
Copy link
Contributor Author

RayAsh37 commented Apr 25, 2023

I found a minor type issue in the CodeSandBox example I was using. You can test it for yourself. I tried to replicate the same scenario.

Another Stack-overflow suggestion that I used for declaring refObject. It works perfectly except TS is making a fuss.

The discussion regarding the type issue can be found here. Although the comment by shane got a lot of love, it seems that it was not solving the problem as seen here. I faced the same issue in the code-sandbox. You can give it a try.

apparently forwarding useRef is a pain especially when types are involved

Until review @gtsiolis , I will be working on another one

@gtsiolis gtsiolis merged commit 4002564 into gitpod-io:gt/merge-17326 Apr 28, 2023
@gtsiolis
Copy link
Contributor

@RayAsh37 I've opened #17430 to spin up a preview environment and see how this looks in action.

@gtsiolis
Copy link
Contributor

Cross-posting #17707 for visibility, see also #17707 (review).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pressing enter on confirmation modal deletes the entry even if cancel is focused
3 participants