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

kie-issues#158: Automatically focus and select file name when creating a new file on KIE Sandbox #1667

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

kbowers-ibm
Copy link
Contributor

@kbowers-ibm kbowers-ibm commented May 25, 2023

Closes apache/incubator-kie-issues#158
Whenever a new file is created from the home page, or from the 'New File' dropdown in the Editor page, the name will be selected so user's can easily create a meaningful name

@kbowers-ibm kbowers-ibm temporarily deployed to ci May 25, 2023 10:55 — with GitHub Actions Inactive
@kbowers-ibm kbowers-ibm temporarily deployed to ci May 25, 2023 10:55 — with GitHub Actions Inactive
@kbowers-ibm kbowers-ibm temporarily deployed to ci May 25, 2023 10:55 — with GitHub Actions Inactive
@kbowers-ibm kbowers-ibm changed the title kie-issues#158 Automatically focus and select file name when creating a new file on KIE Sandbox kie-issues#158: Automatically focus and select file name when creating a new file on KIE Sandbox May 25, 2023
@tiagobento
Copy link
Contributor

@kbowers-ibm So I think there's a problem with this approach.... If I WANT my file to be called "Untitled", every time I open it, its name will be selected. I think we're going to need a queryParam here to make sure this behavior is only triggered when a "New file" operation happens.

@kbowers-ibm
Copy link
Contributor Author

Fair enough, will look into using a queryParam, thanks! :)

@kbowers-ibm kbowers-ibm temporarily deployed to ci June 7, 2023 12:55 — with GitHub Actions Inactive
@kbowers-ibm kbowers-ibm temporarily deployed to ci June 7, 2023 12:55 — with GitHub Actions Inactive
@kbowers-ibm kbowers-ibm temporarily deployed to ci June 7, 2023 12:55 — with GitHub Actions Inactive
@kbowers-ibm kbowers-ibm marked this pull request as draft June 7, 2023 13:29
@kbowers-ibm
Copy link
Contributor Author

Video showing:
URL that has no queryparam, when clicking on add new file, it will add the queryparam, but not take you to a new file as expected. But when it does have the queryparam it will work and proceed to the new file

queryParam.mp4

Copy link
Contributor

@danielzhe danielzhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found an issue:

  1. Create a new file and name it something like "TestName"
  2. Try to create another new file

You will notice the the file isn't created instead the focus goes to the current "TestName", so user has to go to "New File" again.

It may be confuse to the users. I'm not sure if it's clear the description of the issue so there is a video.

Screen.Recording.2023-06-27.at.16.40.32.mov

@kbowers-ibm
Copy link
Contributor Author

Hi @danielzhe,
Thanks for the review! Yeah apologies, this shouldn't really be a draft PR as there's still a few kinks to iron out. I have a comment in the WorkspaceFileHooks.tsx that explains why the above is happening. The problem is the workspaceFilePromise is being cancelled before it's being set to the new value, and so reverts back to the old value. I'm just not quite sure how to stop it from being cancelled, e.g. putting something like don't cancel if only the queryparam in the URL has changed.

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.

Automatically focus and select file name when creating a new file on KIE Sandbox
3 participants