Skip to content

TimeAgo + SSR somewhat problematic #288

@adamschwartz

Description

@adamschwartz

Our use of <TimeAgo/> is slightly wonky with SSR:

<TimeAgo date={tutorial.updated} formatter={(value, unit) => (
<React.Fragment>
{value} {unit}{value > 1 ? "s" : ""}<span className="DocsTutorials--ago-text"> ago</span>
</React.Fragment>
)} minPeriod={60}/>

It can flash "N hours ago" and then switch to "3 days ago" on page load for example. This is because the SSR time will be locked in at the last time it was built, but upon hydration it will be from now.

We could potentially use HTMLRewriter to set on the fly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions