Skip to content

Commit

Permalink
Few more framework-demo tweaks; throw error when missing components
Browse files Browse the repository at this point in the history
  • Loading branch information
SachaG committed Feb 19, 2017
1 parent a658e78 commit ba32f42
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 52 deletions.
27 changes: 0 additions & 27 deletions packages/framework-demo/lib/fragments.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/framework-demo/lib/modules/components.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '../components/Accounts.jsx';
import '../components/AccountsForm.jsx';
import '../components/MoviesDetails.jsx';
import '../components/MoviesEditForm.jsx';
import '../components/MoviesItem.jsx';
Expand Down
6 changes: 0 additions & 6 deletions packages/framework-demo/lib/modules/permissions.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import Users from 'meteor/nova:users';

const guestsActions = [
'movies.view.own',
'movies.view.all',
];
Users.groups.guests.can(membersActions);

const membersActions = [
'movies.new',
'movies.edit.own',
Expand Down
4 changes: 2 additions & 2 deletions packages/framework-demo/lib/modules/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const resolvers = {

name: 'moviesList',

resolver(root, {terms}, context, info) {
resolver(root, {terms = {}}, context, info) {
let {selector, options} = context.Movies.getParameters(terms);
options.limit = (terms.limit < 1 || terms.limit > 100) ? 100 : terms.limit;
options.fields = context.getViewableFields(context.currentUser, context.Movies);
Expand All @@ -51,7 +51,7 @@ const resolvers = {

name: 'moviesTotal',

resolver(root, {terms}, context) {
resolver(root, {terms = {}}, context) {
let {selector, options} = context.Movies.getParameters(terms);
return context.Movies.find(selector, options).count();
},
Expand Down
15 changes: 0 additions & 15 deletions packages/nova-base-components/lib/common/Error404.jsx

This file was deleted.

1 change: 0 additions & 1 deletion packages/nova-base-components/lib/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import './common/FlashMessages.jsx';
import './common/Newsletter.jsx';
import './common/NewsletterButton.jsx';
import './common/SearchForm.jsx';
import './common/Error404.jsx';
import './common/Vote.jsx';

// posts
Expand Down
3 changes: 3 additions & 0 deletions packages/nova-lib/lib/modules/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export const registerComponent = (name, rawComponent, ...hocs) => {
*/
export const getComponent = (name) => {
const component = ComponentsTable[name];
if (!component) {
throw new Error(`Component ${name} not registered.`)
}
const hocs = component.hocs.map(hoc => Array.isArray(hoc) ? hoc[0](hoc[1]) : hoc);
return compose(...hocs)(component.rawComponent)
};
Expand Down

0 comments on commit ba32f42

Please sign in to comment.