Skip to content

feat(fieldconfig): decorator is added#76

Merged
cl-shaharshavit-rnd merged 4 commits intomasterfrom
field_config_decorator
Jun 17, 2021
Merged

feat(fieldconfig): decorator is added#76
cl-shaharshavit-rnd merged 4 commits intomasterfrom
field_config_decorator

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

const classDataList = getGraphQLClassMapping();
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