fmaclen / hollama

A minimal web-UI for talking to Ollama servers
https://hollama.fernando.is
MIT License
316 stars 27 forks source link

fix: fix scrolling after submitting a prompt #163

Closed GregoMac1 closed 2 weeks ago

GregoMac1 commented 2 weeks ago

@fmaclen I found the problem. This bug is happening because handleCompletion sets isCompletionInProgress to true, which makes the ... message visible:

{#if isCompletionInProgress}
  <Article message={{ role: 'assistant', content: completion || '...' }} />
{/if}

It seems that this render occurs after the scrollToBottom invocation.

I fixed it by using the requestAnimationFrame function, which schedules the scroll action to occur in the next frame after the browser has completed its current rendering tasks.

fmaclen commented 2 weeks ago

:tada: This PR is included in version 0.10.2 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: