product-os / jellyfish-ui-components

Jellyfish UI components library
Apache License 2.0
1 stars 0 forks source link

Fix timeline not loading older messages #789

Closed karaxuna closed 3 years ago

karaxuna commented 3 years ago

Change-type: patch See: https://www.flowdock.com/app/rulemotion/user_happiness/threads/7NZvqy1kZMKauU_gaEgLG6zcuRI


When fetching timeline events, limit is set to 20, but most of them may be events that are hidden by default, like: create, update, formula re-evaluation... So we end up seeing 3 messages which does not fill vertical space. There is a code in ui starts fetching more events if the scrollbar is on beginning of list, except if it's not already loading (which is the case when loading initial data), so nothing happens:

tmp tmp

In this pr, we check scrollbar location after loading initial data and fetch more if it's on the beginning of the list.

LucianBuzzo commented 3 years ago
FAIL lib/Timeline/tests/index.spec.tsx (30.552 s)
  ● Events are toggled when the event in the url is one of type UPDATE

    TypeError: scrollAreaRef.current.scrollTo is not a function

      64 |              },
      65 |              scrollToBottom(options: any = {}) {
    > 66 |                  scrollAreaRef.current!.scrollTo({
         |                                         ^
      67 |                      top: scrollAreaRef.current!.scrollHeight,
      68 |                      ...options,
      69 |                  });

      at Object.scrollToBottom (lib/InfiniteList.tsx:66:29)
      at Timeline.componentDidMount (lib/Timeline/index.tsx:119:30)