File tree Expand file tree Collapse file tree 2 files changed +8
-32
lines changed Expand file tree Collapse file tree 2 files changed +8
-32
lines changed Original file line number Diff line number Diff line change @@ -283,24 +283,11 @@ function $$default(props) {
283
283
}
284
284
285
285
function getStaticProps ( _ctx ) {
286
- var match = Belt_Array . reduce ( BlogApi . getAllPosts ( undefined ) , [
287
- [ ] ,
288
- [ ]
289
- ] , ( function ( acc , postData ) {
290
- var archived = acc [ 1 ] ;
291
- var posts = acc [ 0 ] ;
292
- if ( postData . archived ) {
293
- archived . push ( postData ) ;
294
- } else {
295
- posts . push ( postData ) ;
296
- }
297
- return [
298
- posts ,
299
- archived
300
- ] ;
286
+ var match = Belt_Array . partition ( BlogApi . getAllPosts ( undefined ) , ( function ( data ) {
287
+ return data . archived ;
301
288
} ) ) ;
302
- var props_posts = match [ 0 ] ;
303
- var props_archived = match [ 1 ] ;
289
+ var props_posts = match [ 1 ] ;
290
+ var props_archived = match [ 0 ] ;
304
291
var props = {
305
292
posts : props_posts ,
306
293
archived : props_archived
Original file line number Diff line number Diff line change @@ -244,7 +244,7 @@ let default = (props: props): React.element => {
244
244
author = first .frontmatter .author
245
245
firstParagraph = ?{first .frontmatter .description -> Js .Null .toOption }
246
246
date = {first .frontmatter .date -> DateStr .toDate }
247
- slug = BlogApi .blogPathToSlug (first .path )
247
+ slug = { BlogApi .blogPathToSlug (first .path )}
248
248
/>
249
249
</div >
250
250
@@ -263,7 +263,7 @@ let default = (props: props): React.element => {
263
263
author = post .frontmatter .author
264
264
?badge
265
265
date = {post .frontmatter .date -> DateStr .toDate }
266
- slug = BlogApi .blogPathToSlug (post .path )
266
+ slug = { BlogApi .blogPathToSlug (post .path )}
267
267
/>
268
268
})-> React .array }
269
269
</div >
@@ -312,21 +312,10 @@ let default = (props: props): React.element => {
312
312
}
313
313
314
314
let getStaticProps : Next .GetStaticProps .t <props , params > = _ctx => {
315
- let (posts , archived ) = BlogApi .getAllPosts ()-> Belt .Array .reduce (([], []), (
316
- acc ,
317
- postData ,
318
- ) => {
319
- let (posts , archived ) = acc
320
- if postData .archived {
321
- Js .Array2 .push (archived , postData )-> ignore
322
- } else {
323
- Js .Array2 .push (posts , postData )-> ignore
324
- }
325
- (posts , archived )
326
- })
315
+ let (archived , nonArchived ) = BlogApi .getAllPosts ()-> Belt .Array .partition (data => data .archived )
327
316
328
317
let props = {
329
- posts : posts ,
318
+ posts : nonArchived ,
330
319
archived : archived ,
331
320
}
332
321
You can’t perform that action at this time.
0 commit comments