Skip to content

Commit

Permalink
Merge branch 'master' into store_by_id
Browse files Browse the repository at this point in the history
  • Loading branch information
Poincare authored Jul 27, 2016
2 parents 819fe89 + b4ceba9 commit cde2ae1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Expect active development and potentially significant breaking changes in the `0.x` track. We'll try to be diligent about releasing a `1.0` version in a timely fashion (ideally within 3 to 6 months), to signal the start of a more stable API.

### vNEXT
- Fixed issue with `fragments` array for `updateQueries`. [PR #475](https://github.com/apollostack/apollo-client/pull/475) and [Issue #470](https://github.com/apollostack/apollo-client/issues/470).

### v0.4.8

Expand Down
2 changes: 1 addition & 1 deletion src/QueryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ export class QueryManager {
selectionSet: queryDefinition.selectionSet,
variables: queryOptions.variables,
returnPartialData: queryOptions.returnPartialData || queryOptions.noFetch,
fragmentMap: createFragmentMap(fragments || []),
fragmentMap: createFragmentMap(fragments),
});

resultBehaviors.push({
Expand Down
2 changes: 1 addition & 1 deletion src/queries/getFromAST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export interface FragmentMap {

// Utility function that takes a list of fragment definitions and makes a hash out of them
// that maps the name of the fragment to the fragment definition.
export function createFragmentMap(fragments: FragmentDefinition[]): FragmentMap {
export function createFragmentMap(fragments: FragmentDefinition[] = []): FragmentMap {
const symTable: FragmentMap = {};
fragments.forEach((fragment) => {
symTable[fragment.name.value] = fragment;
Expand Down
4 changes: 4 additions & 0 deletions test/getFromAST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ describe('AST utility functions', () => {
assert.deepEqual(fragmentMap, expectedTable);
});

it('should return an empty fragment map if passed undefined argument', () => {
assert.deepEqual(createFragmentMap(undefined), {});
});

it('should get the operation name out of a query', () => {
const query = gql`
query nameOfQuery {
Expand Down

0 comments on commit cde2ae1

Please sign in to comment.