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

GraphQL: Optimize on Relation (and Prettier stuff) #7044

Merged
merged 1 commit into from
Dec 7, 2020

Conversation

Moumouls
Copy link
Member

@Moumouls Moumouls commented Dec 4, 2020

Strange, it seems that some files have not been processed by prettier.

Main fix is here

const needToGetAllKeys = (fields, keys, parseClasses) =>
  keys
    ? keys.split(',').some(keyName => {
        const key = keyName.split('.');
        if (fields[key[0]]) {
// We miss the Relation optimization
          if (fields[key[0]].type === 'Relation') return false;
          if (fields[key[0]].type === 'Pointer') {
            const subClass = parseClasses.find(
              ({ className: parseClassName }) => fields[key[0]].targetClass === parseClassName
            );
            if (subClass && subClass.fields[key[1]]) {
              // Current sub key is not custom
              return false;
            }
          } else if (
            !key[1] ||
            fields[key[0]].type === 'Array' ||
            fields[key[0]].type === 'Object'
          ) {
            // current key is not custom
            return false;
          }
        }
        // Key not found into Parse Schema so it's custom
        return true;
      })
    : true;

@Moumouls Moumouls changed the title Prettier some files + opti object relation GraphQL: Optimize on Relation (and Prettier stuff) Dec 4, 2020
@codecov
Copy link

codecov bot commented Dec 4, 2020

Codecov Report

Merging #7044 (0f4c051) into master (4dee0bc) will increase coverage by 0.04%.
The diff coverage is 54.54%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7044      +/-   ##
==========================================
+ Coverage   93.84%   93.88%   +0.04%     
==========================================
  Files         169      169              
  Lines       12438    12438              
==========================================
+ Hits        11673    11678       +5     
+ Misses        765      760       -5     
Impacted Files Coverage Δ
src/GraphQL/helpers/objectsQueries.js 90.83% <54.54%> (ø)
src/StatusHandler.js 98.55% <0.00%> (-0.73%) ⬇️
src/Options/Definitions.js 100.00% <0.00%> (ø)
src/LiveQuery/ParseLiveQueryServer.js 94.92% <0.00%> (ø)
src/Adapters/Auth/ldap.js 94.00% <0.00%> (+0.12%) ⬆️
src/RestWrite.js 93.84% <0.00%> (+0.16%) ⬆️
src/Adapters/Files/GridFSBucketAdapter.js 80.32% <0.00%> (+0.81%) ⬆️
src/triggers.js 94.60% <0.00%> (+0.89%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4dee0bc...0f4c051. Read the comment docs.

@davimacedo
Copy link
Member

@Moumouls I can't find the changes in the PR. You only pushed the prettier :)

@Moumouls
Copy link
Member Author

Moumouls commented Dec 5, 2020

@davimacedo change is if (fields[key[0]].type === 'Relation') return false;

@@ -10,10 +10,10 @@ const needToGetAllKeys = (fields, keys, parseClasses) =>
? keys.split(',').some(keyName => {
const key = keyName.split('.');
if (fields[key[0]]) {
if (fields[key[0]].type === 'Relation') return false;
Copy link
Member Author

Choose a reason for hiding this comment

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

Herer @davimacedo

Copy link
Member

@davimacedo davimacedo left a comment

Choose a reason for hiding this comment

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

Sorry. My bad. LGTM!

@davimacedo davimacedo merged commit 88e958a into parse-community:master Dec 7, 2020
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.

2 participants