Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the filter parameter in the @connection directive #1862

Merged
merged 4 commits into from
Jul 9, 2017

Conversation

shadaj
Copy link
Contributor

@shadaj shadaj commented Jul 6, 2017

TODO:

  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass
  • Update CHANGELOG.md with your change
  • If this was a change that affects the external API, update the docs and post a link to the PR in the discussion
  • If this was a change that affects the external API used in GitHunt-React, update GitHunt-React and post a link to the PR in the discussion.

@shadaj shadaj self-assigned this Jul 6, 2017
@shadaj shadaj requested a review from stubailo July 6, 2017 19:45
@shadaj shadaj force-pushed the connection-filter branch from 2f2425d to 5f9a48f Compare July 6, 2017 19:46
Copy link
Contributor

@stubailo stubailo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to get a second opinion on the resulting store key.

const queryArgs = args as {[key: string]: any};

if (filterKeys.length > 0) {
const filterExtra = filterKeys.map((key) => `${key}:${JSON.stringify(queryArgs[key])}`).reduce((a, b) => `${a}_${b}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a pretty random serialization. I guess it's:

fieldName_arg:"value"_otherArg:17

Curious if @jbaxleyiii has an opinion for the right store key. For context I think the current ones look like:

fieldName({arg:"value",otherArg:17})

The appearance matters because this will show up in the dev tools.

Anyway, instead of the reduce we could use .join('_').

@shadaj shadaj force-pushed the connection-filter branch from 5f9a48f to 0e8e2b0 Compare July 7, 2017 17:39
@shadaj
Copy link
Contributor Author

shadaj commented Jul 7, 2017

@shadaj
Copy link
Contributor Author

shadaj commented Jul 7, 2017

@stubailo stubailo merged commit 1c698cf into master Jul 9, 2017
@stubailo
Copy link
Contributor

stubailo commented Jul 9, 2017

Great work, @shadaj!

@shadaj shadaj deleted the connection-filter branch July 14, 2017 17:35
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants