gitmoji-cli icon indicating copy to clipboard operation
gitmoji-cli copied to clipboard

Replace `inquirer` with `prompts`

Open segersniels opened this issue 2 years ago • 6 comments

Description of the problem

It seems like inquirer still has issues with flickering prompts when typing which results in bad UX which it has been having for a very long time.

Solution

Might have to check if viable to switch away from inquirer to something like prompts for better UX. From my own experiences prompts doesn't have this issue.

https://www.npmjs.com/package/prompts

Alternatives

No response

Additional context

See video for weird flickering issue in inquirer.

https://user-images.githubusercontent.com/10974647/236788387-4ff044dd-9096-40ca-bcfa-c613b0b73c78.mov

Validations

segersniels avatar May 07 '23 19:05 segersniels

Hey! @segersniels thanks for opening the issue I believe it's a great idea

I'm happy to move away from inquirer if this library provides better UX for our users. I see they even have autocomplete support, so we should be able to fit this 1:1 ❤️

carloscuesta avatar May 30 '23 17:05 carloscuesta

Had a quick go at this. While it does provide better UX (read: less flickering) during gitmoji selection it does introduce a bunch of flickering during the title prompt due to the input transforming that takes place (showing capitalization and max title length count). Without the mutation of the input the rendering is fine, but don't want to introduce regressions so going to leave this as is.

segersniels avatar Jun 06 '23 13:06 segersniels

https://github.com/carloscuesta/gitmoji-cli/assets/10974647/bd11a48c-fe7f-4b3c-9495-5811ac380bcb

https://github.com/carloscuesta/gitmoji-cli/assets/10974647/b13e37bd-ddcd-413f-b6e6-a7c536c2f65d

segersniels avatar Jun 06 '23 13:06 segersniels

Actually, I just noticed that the live version also flickers when typing during the title prompt. So there's not really a regression (besides maybe a slight increase in flickering). Doesn't take away from the fact that transforming the title during typing slows down the rendering and causes the flickering as you can see in the first video posted where the mutation doesn't happen and there's no flickering (with prompts).

https://github.com/carloscuesta/gitmoji-cli/assets/10974647/9ea1878c-1229-4aba-8726-c70c8640346e

segersniels avatar Jun 07 '23 11:06 segersniels

Doesn't take away from the fact that transforming the title during typing slows down the rendering and causes the flickering as you can see in the first video posted where the mutation doesn't happen and there's no flickering (with prompts).

Yes, every transformation to the input will cause some flickering as the terminal needs to re-render that reacting to user input, so it will flicker no matter what dependency we use for the prompts.

Even though looks like in the auto select prompt the experience is a bit better (as there's no flickering at all)

carloscuesta avatar Jun 07 '23 12:06 carloscuesta

Even though looks like in the auto select prompt the experience is a bit better (as there's no flickering at all)

~~Assuming you're talking about the first video posted, that's without the first letter capitalisation visible during writing and the max character length though. Removing that would be a slight regression in UX since people probably have grown used to it (more so the char length count).~~

Thought you were talking about the text input. Yeah the select prompt of the gitmojis is a lot smoother with prompts.

segersniels avatar Jun 07 '23 13:06 segersniels

Closing this for the time being. Might revisit in the future as there's no complaints coming in from other people.

segersniels avatar Feb 12 '24 09:02 segersniels