Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Added: (boilerplate) more layouts and components so new users have more... #395

Merged
merged 1 commit into from
Apr 19, 2016

Conversation

MoOx
Copy link
Owner

@MoOx MoOx commented Apr 15, 2016

…example to show list of entries.

screen shot 2016-04-15 at 07 21 26

No sure why, for the first page (server side rendered), I got a react warning:

Warning: Failed propType: Invalid prop `date` of type `date` supplied to `PagePreview`, expected `string`. Check the render method of `PagesList`.

No idea why I get a "date" for the date field. gray-matter is not converting date (I checked the code), and client side, clearly have string, so no fucking idea.

sort: "date",
reverse: true,
})
.slice(0, numberOfLatestPosts)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enhanceCollection has a limit option for this job.

Maybe we can extend it to support pagination

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pagination will be another thing, later :)
Will use limit :)

@thangngoc89
Copy link
Contributor

I ran into this before. Can't figure out what's going on.

@thangngoc89
Copy link
Contributor

Not sure this is a bug or a feature. This came from gray-matter's dep js-yaml. It will parse date automatically. See https://github.com/dplepage/js-yaml/blob/5f058c3a78fd1a1bd36fd2cdc2c3a8c45ab53fd1/lib/js-yaml/type/timestamp.js#L79

The data which is sent to the client was JSON.stringify so it's a string

@MoOx
Copy link
Owner Author

MoOx commented Apr 15, 2016

I tried to assume it's a date, but somewhere else (client side), dates are string, so not consistent with server cache, which have real dates. We should normalize this. Opening an issue.

@thangngoc89
Copy link
Contributor

Could we merge this and deal with the auto parsing date later ?

@MoOx MoOx force-pushed the boilerplate.more-components branch from 634c7ce to 868a7f4 Compare April 19, 2016 08:29
@MoOx MoOx merged commit 172c68b into next Apr 19, 2016
@MoOx MoOx deleted the boilerplate.more-components branch April 19, 2016 08:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants