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

feat(fieldconfig): decorator is added #76

Merged
merged 4 commits into from
Jun 17, 2021

Conversation

alebinson
Copy link
Contributor

New fieldConfig decorator is added

}

ret.push(fieldConfig);
// ret.push({
Copy link
Contributor

Choose a reason for hiding this comment

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

delete comment or add TODO if it is useful for near future update

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


const fieldConfigMetadataKey = Symbol('fieldconfigclass');
type KeyValueDict = Record<string, unknown>;
const target = {};
Copy link
Contributor

Choose a reason for hiding this comment

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

I should have thought about it earlier but since target is static and global it can be used to store the data directly without using reflect metadata.
it will make the code bit simpler to understand.

up to you if u want to change it, its ok either way by my standard (for this use case)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, reflection is removed, more clean code

@lgtm-com
Copy link

lgtm-com bot commented Jun 17, 2021

This pull request introduces 2 alerts when merging cbb9db1 into 2c885c4 - view on LGTM.com

new alerts:

  • 2 for Ignoring result from pure array method


const classDataList = getFieldConfigClassesInfo();
classDataList.push(classData);
target.concat(classDataList);
Copy link
Contributor

Choose a reason for hiding this comment

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

concat doesn't update the target in js but returns new array

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, working directly with target

classDataList.push(classData);
Reflect.defineMetadata(graphQLMetadataKey, classDataList, target);
target.concat(classDataList);
Copy link
Contributor

Choose a reason for hiding this comment

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

concat doesn't update the target in js but returns new array

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, working directly with target

@cl-shaharshavit-rnd cl-shaharshavit-rnd merged commit cf66c1c into master Jun 17, 2021
@cl-shaharshavit-rnd cl-shaharshavit-rnd deleted the field_config_decorator branch June 17, 2021 11:07
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