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: duplicate DRP call #432

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

hoangquocvietuet
Copy link
Contributor

Resolved: #404

@sfroment sfroment force-pushed the fix/duplicate-drp-call branch from b6e40e3 to b42cc8b Compare February 5, 2025 20:45
packages/object/src/index.ts Show resolved Hide resolved
packages/object/src/index.ts Outdated Show resolved Hide resolved
packages/object/src/index.ts Show resolved Hide resolved
Comment on lines +197 to +199
const computeFn = isACL ? this._computeObjectACL : this._computeDRP;
const vertexDependencies = this.hashGraph.getFrontier();
const preOperationDRP = computeFn(vertexDependencies);
Copy link
Member

Choose a reason for hiding this comment

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

why don't you call these functions directly instead of defining a new variable computeFn. it just makes the code harder to understand

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't agree with this statement, but we can still discuss about it

Copy link
Contributor

Choose a reason for hiding this comment

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

it remove and if else and also remove the fact that we have to add a let var

Copy link
Contributor

@sfroment sfroment Feb 9, 2025

Choose a reason for hiding this comment

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

this way is more js idiomatic, in js the more you are functional the better it is .
Overall the less mutation you have the better, also the more reliability and readability you'll have

Copy link
Member

Choose a reason for hiding this comment

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

i mean:

const preOperationDRP = isACL ? this._computeObjectACL(vertexDependencies) :  this._computeDRP(vertexDependencies);

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yes 👍!

Comment on lines +160 to +161
const appliedOperationResult = obj.callFn(fullPropKey, args, vertexType);
return appliedOperationResult;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const appliedOperationResult = obj.callFn(fullPropKey, args, vertexType);
return appliedOperationResult;
return obj.callFn(fullPropKey, args, vertexType);

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.

Fix duplicate DPR call
3 participants