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

stop flickery svelte components on input #25

Closed
ParthJadhav opened this issue Jan 4, 2023 · 1 comment · Fixed by #30
Closed

stop flickery svelte components on input #25

ParthJadhav opened this issue Jan 4, 2023 · 1 comment · Fixed by #30
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@ParthJadhav
Copy link
Owner

The half of the window is re-rendered when there is any input. This causes it to look like it's glitching.

@ParthJadhav ParthJadhav added bug Something isn't working help wanted Extra attention is needed labels Jan 4, 2023
@ParthJadhav
Copy link
Owner Author

ParthJadhav commented Jan 4, 2023

It only happens with the Calculator Component which was added recently

https://github.com/ParthJadhav/Verve/blob/master/src/routes/App/lib/CalculationResult.svelte

Ty3uK added a commit to Ty3uK/Verve that referenced this issue Jan 5, 2023
Related to ParthJadhav#25.

Search results flickers because of three things:

- `handleInput` resets the `results` array, which immediately re-renders
  `SearchResult` component
- Changing styles on `focus` and `blur` are not immediate operation, that's why another
  kind of flickering is a transition between focused and non-focused
  state
- `getIcon` function is another bottleneck, preservation of space for
  upcomming <img> tag is a key for rescue

Most "ugly" part of this code is manipulating with classes. Changing
classes through Svelte's `class:` directive leads to focus lost.

Unfortunately, manipulating classes through script cannot be made with
obfuscated selectors, that's why you can see `:global` in code. Maybe you
know better way to change classes without losing focus.
Ty3uK added a commit to Ty3uK/Verve that referenced this issue Jan 5, 2023
Related to ParthJadhav#25.

Search results flickers because of three things (IMO):

- `handleInput` resets the `results` array, which immediately dropping
  list with `#if` directive in `SearchResult` component
- Changing styles on `focus` and `blur` are not immediate operation, that's why another
  kind of flickering is a transition between focused and non-focused
  state (gray background)
- `getIcon` function is another "bottleneck"; preservation of space for
  upcomming <img> tag is a key for rescue

Most "ugly" part of this code is manipulating with classes. Changing
classes through Svelte's `class:` binding leads to focus lost.

Unfortunately, manipulating classes through script cannot be made with
obfuscated selectors, that's why you can see `:global` in code. Maybe you
know better way to change classes without losing focus.
@ParthJadhav ParthJadhav linked a pull request Jan 6, 2023 that will close this issue
ParthJadhav added a commit that referenced this issue Jan 9, 2023
* fix: reduce flickering

Related to #25.

Search results flickers because of three things (IMO):

- `handleInput` resets the `results` array, which immediately dropping
  list with `#if` directive in `SearchResult` component
- Changing styles on `focus` and `blur` are not immediate operation, that's why another
  kind of flickering is a transition between focused and non-focused
  state (gray background)
- `getIcon` function is another "bottleneck"; preservation of space for
  upcomming <img> tag is a key for rescue

Most "ugly" part of this code is manipulating with classes. Changing
classes through Svelte's `class:` binding leads to focus lost.

Unfortunately, manipulating classes through script cannot be made with
obfuscated selectors, that's why you can see `:global` in code. Maybe you
know better way to change classes without losing focus.

* fix: span attributes

* fix: remove icon flickering with icons cache

* fix: reset `results` when search pattern is empty

* chore: fix extra rectangular overlay on calculation results

* chore: fix closing window when pressing enter/return

* chore: fix keys not being registered

Co-authored-by: Parth Jadhav <jadhavparth99@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant