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

fix fieldNameNormalizer mangling ArrayBuffer/Blob types #247

Merged
merged 1 commit into from
Jan 5, 2022

Conversation

TylerShin
Copy link
Contributor

Fix bug situation.

currently fieldNameNormalizer makes ArrayBuffer or Blob to {};
especially use it with responseTransformer.

for example,

const restLink = new RestLink({
  credentials: 'same-origin',
  uri: getAPIPrefix(),
  endpoints: {
    pdfSource: {
      uri: DIRECT_PDF_PATH_PREFIX,
      responseTransformer: async res => {
        // res is the binary data
        const data = await res.arrayBuffer();
        return { data };
      },
    },
  },
  fieldNameNormalizer: (key: string) => {
    return camelCase(key);
  },
});

after using useQuery, data always return {};
Because convertObjectKeys function thinks of Blob of ArrayBlob as a normal Object that could be serialized.

@apollo-cla
Copy link

@TylorShin: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

@fbartho fbartho self-assigned this Apr 23, 2020
@fbartho fbartho added this to the 0.8.0 milestone Apr 23, 2020
@fbartho
Copy link
Collaborator

fbartho commented Apr 23, 2020

@TylorShin thanks for the PR -- do you have an urgent need for this? Currently, our plan is to ship Milestone 0.8.0 in Late May/Early June with compatibility for ApolloClient 3!

Additionally, please sign the Apollo CLA so that we can consider this!

@TylerShin
Copy link
Contributor Author

@TylorShin thanks for the PR -- do you have an urgent need for this? Currently, our plan is to ship Milestone 0.8.0 in Late May/Early June with compatibility for ApolloClient 3!

Additionally, please sign the Apollo CLA so that we can consider this!

Thanks for the quick reply!
I can use it from my forked repository version. Also, there is no project using it in a production environment yet.

So, yes. I can wait for it until the new version coming. I'm looking forward to migrating.
And finally, I signed Apollo CLA! 😉

@fbartho
Copy link
Collaborator

fbartho commented Feb 18, 2021

@TylerShin -- I know it's been almost a year, but I'm looking to ship the stable release next month! -- Since you've been working on a forked version of the repo, do you have any other features you want to contribute back?

Sorry for the delay!

@TylerShin
Copy link
Contributor Author

@fbartho No I have not used Apollo for long time. It's totally okay.

@fbartho fbartho modified the milestones: 0.8.0, v0.next Jan 5, 2022
@fbartho fbartho changed the title fix fieldNameNormalizer bug fix fieldNameNormalizer mangling ArrayBuffer/Blob types Jan 5, 2022
@fbartho
Copy link
Collaborator

fbartho commented Jan 5, 2022

This will ship in v0.9.0

fbartho added a commit that referenced this pull request Jan 5, 2022
@fbartho fbartho merged commit e6e0f4d into apollographql:master Jan 5, 2022
@fbartho
Copy link
Collaborator

fbartho commented Jan 5, 2022

Shipped in the pre-release of 0.9.0-rc.1 please advise if you have any issues

@fbartho
Copy link
Collaborator

fbartho commented Nov 15, 2022

Shipped this in v0.9.0! -- Enjoy! https://www.npmjs.com/package/apollo-link-rest/v/0.9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants