Skip to content

Commit

Permalink
Fix for SSR
Browse files Browse the repository at this point in the history
  • Loading branch information
phortx committed Apr 8, 2019
1 parent 8eb0621 commit 16425f8
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dist/vuex-orm-graphql.es5.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vuex-orm-graphql.es5.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vuex-orm-graphql.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vuex-orm-graphql.umd.js.map

Large diffs are not rendered by default.

8 changes: 1 addition & 7 deletions src/support/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,7 @@ export function graphQlDocumentToString(query: DocumentNode): string {
*/
export function isPlainObject(obj: any): boolean {
// Basic check for Type object that's not null
if (typeof obj === "object" && obj !== null) {
const proto = Object.getPrototypeOf(obj);
return proto === Object.prototype || proto === null;
}

// Not an object
return false;
return obj !== null && typeof obj === "object";
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/vuex-orm-graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ export default class VuexORMGraphQL {
bypassCache = false
) {
let filterObj = filter;
if (!isPlainObject(filterObj)) filterObj = { id: filter };
if (!isPlainObject(filterObj)) {
filterObj = { id: filter };
}
return this.dispatch("fetch", { filter: filterObj, bypassCache });
};

Expand Down

0 comments on commit 16425f8

Please sign in to comment.