From bdfa76aca6d7a4d9b12f284e774384cadab6db75 Mon Sep 17 00:00:00 2001 From: SachaG Date: Sat, 4 Feb 2017 11:43:21 +0900 Subject: [PATCH] Improve error logging on server; add createdAt to PostsList fragment; use componentNames for base routes --- packages/_react-router-ssr/lib/server.jsx | 1 + packages/nova-base-components/lib/fragments.js | 3 ++- packages/nova-base-components/lib/routes.js | 16 ++++++++-------- packages/nova-posts/lib/schema.js | 1 - 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/_react-router-ssr/lib/server.jsx b/packages/_react-router-ssr/lib/server.jsx index 08636fd612..b484f27675 100644 --- a/packages/_react-router-ssr/lib/server.jsx +++ b/packages/_react-router-ssr/lib/server.jsx @@ -238,6 +238,7 @@ function generateSSRData(clientOptions, serverOptions, req, res, renderProps) { InjectData.pushData(res, 'fast-render-data', data); } catch(err) { + console.log(err) console.error(new Date(), 'error while server-rendering', err.stack); } }); diff --git a/packages/nova-base-components/lib/fragments.js b/packages/nova-base-components/lib/fragments.js index 84a416289c..85d3f3cf14 100644 --- a/packages/nova-base-components/lib/fragments.js +++ b/packages/nova-base-components/lib/fragments.js @@ -1,4 +1,4 @@ -import { registerFragment } from 'meteor/nova:core'; +import { registerFragment, getFragment } from 'meteor/nova:core'; // ------------------------------ Vote ------------------------------ // @@ -99,6 +99,7 @@ registerFragment(` url slug postedAt + createdAt sticky status body diff --git a/packages/nova-base-components/lib/routes.js b/packages/nova-base-components/lib/routes.js index 7a577be42a..9d146bd930 100644 --- a/packages/nova-base-components/lib/routes.js +++ b/packages/nova-base-components/lib/routes.js @@ -1,11 +1,11 @@ -import { getComponent, addRoute } from 'meteor/nova:core'; +import { addRoute } from 'meteor/nova:core'; addRoute([ - {name:'posts.list', path: '/', component: getComponent('PostsHome')}, // index route - {name:'posts.daily', path:'daily', component: getComponent('PostsDaily')}, - {name:'posts.single', path:'posts/:_id(/:slug)', component: getComponent('PostsSingle')}, - {name:'users.single', path:'users/:slug', component: getComponent('UsersSingle')}, - {name:'users.account', path:'account', component: getComponent('UsersAccount')}, - {name:'resetPassword', path:'reset-password/:token', component: getComponent('UsersResetPassword')}, - {name:'users.edit', path:'users/:slug/edit', component: getComponent('UsersAccount')}, + {name:'posts.list', path: '/', componentName: 'PostsHome'}, // index route + {name:'posts.daily', path:'daily', componentName: 'PostsDaily'}, + {name:'posts.single', path:'posts/:_id(/:slug)', componentName: 'PostsSingle'}, + {name:'users.single', path:'users/:slug', componentName: 'UsersSingle'}, + {name:'users.account', path:'account', componentName: 'UsersAccount'}, + {name:'resetPassword', path:'reset-password/:token', componentName: 'UsersResetPassword'}, + {name:'users.edit', path:'users/:slug/edit', componentName: 'UsersAccount'}, ]); diff --git a/packages/nova-posts/lib/schema.js b/packages/nova-posts/lib/schema.js index beb603e731..764dcb2827 100644 --- a/packages/nova-posts/lib/schema.js +++ b/packages/nova-posts/lib/schema.js @@ -34,7 +34,6 @@ const schema = { type: Date, optional: true, viewableBy: ['admins'], - publish: true, // publish so that admins can sort pending posts by createdAt autoValue: (documentOrModifier) => { if (documentOrModifier && !documentOrModifier.$set) return new Date() // if this is an insert, set createdAt to current timestamp }