-
Notifications
You must be signed in to change notification settings - Fork 42
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
[Timeline]: Earliest date defaulted to current date when found date was later than current day #3458
Conversation
🦋 Changeset detectedLatest commit: f381fae The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Storybook demo603ccef14 | 91 komponenter | 135 stories |
); | ||
|
||
return earliestDate; | ||
}, [startDate, rows]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The useMemo
in useEarliestDate
seems to be running on every render. I think it's because of rows
. We can fix it later since it wasn't added in this PR, but I think we should reconsider all use of useMemo
in this component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this potentially something that we can just delete entirely when we have upgraded to react 19 and decided to use the compiler... 🤔 (and the compiler should be able to optimise re-renders?)
Actually, I don't think it will make sense for a design system to "use the react compiler" (we wouldn't be able to use it on behalf of our consumers 😅 ), so nvm this.
Co-authored-by: Halvor Haugan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember changeset!
Description
Resolves #3457
In short, if earliest date found was "1 jan 2027" and current date is "1 jan 2024" the returned date was "1 jan 2024". This was caused by the "default"-value in reduce being
new Date()
Component Checklist 📝
@navikt/core/css/config/_mappings.js
)@navikt/core/css/tokens.json
)@navikt/aksel-stylelint/src/deprecations.ts
)@navikt/core/react/src/index.ts
and@navikt/core/react/package.json
)@navikt/core/css/index.css
)<Component>: <gitmoji?> <Text>.
E.g. "Button: ✨ Add feature xyz.")