Timeline timestamp not updating

Couldn’t help but notice:

After a refresh it’s updated. But it should be more logical if it matches the post timestamp, which is updated w/o refresh.

2 Likes

Interesting one, could be related to our glimmer move @isaac

3 Likes

Digging in to the old implementation, I am wondering if this was a issue before as well…

      const bottomAge = relativeAge(
        new Date(topic.last_posted_at || topic.created_at),
        {
          addAgo: true,
          defaultFormat: timelineDate,
        }
      );
      const scroller = [
        h(
          "div.timeline-date-wrapper",
          this.attach("link", {
            className: "now-date",
            rawLabel: bottomAge,
            action: "jumpBottom",
          })
        ),
      ];

This was called in the html() function of the widget, which it doesn’t look like we have any hooks for updating this as the time passes.

Obviously the desired functionality is to update the bottomAge with the newest date on post creation, and then continue to update it automatically as the time passes. What we can do right now is add a function to

and update bottomAge on scroll, but in practice feels a little odd. Another issue with this idea is that it is difficult to match the timing of the updating of the date on the latest post to the updating of the bottomAge date on the topic timeline. The relative created_at on a post lags behind by a 10 seconds or so… creating a miss match between

when you are scrolling.

Ideally we would track the relative post created_at date and just plug it in to the timeline, but I don’t know if this is possible atm.

@david, do you have any ideas?

2 Likes

Yeah that would be ideal :+1:

If we use the right HTML structure, the automatic updating over time can be handled automatically by our relative-date helper.

To handle changes to the topic.last_posted_at value, we should be able to lean on Glimmer’s reactivity, rather than doing stuff on scroll. e.g.

get bottomAge(){
  return this.args.topic.get("last_posted_at") || this.args.topic.get("created_at");
}

And then in the hbs we can use our relative age helper to render it in the right structure for the auto-updating

{{age-with-tooltip this.bottomAge}}

Might need to make some improvements to the helper so that it can support the ‘addAgo’ and ‘defaultFormat’ parameters?

1 Like

This will be fixed via

5 Likes