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 deepFreeze #657

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix deepFreeze #657

wants to merge 1 commit into from

Conversation

fisehara
Copy link
Contributor

Actually deep freezing the constrainedAbstractSqlModel

Change-type: patch

@flowzone-app flowzone-app bot enabled auto-merge April 19, 2023 11:29
obj.hasOwnProperty(prop) &&
obj[prop] !== null &&
!['object', 'function'].includes(typeof obj[prop])
// `synonyms` is apparently changed later on and cannot be deepFroozen
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where is synonyms modified?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Page-
In the get Proxy here:

synonyms[`${synonym}$${alias}`] = `${canonicalForm}$${alias}`;

@@ -715,19 +715,18 @@ const onceGetter = <T, U extends keyof T>(
};

const deepFreezeExceptDefinition = (obj: AnyObject) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ExceptDefinition isn't accurate to what this is attempting to do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep corrected.

@@ -1036,9 +1035,9 @@ const getBoundConstrainedMemoizer = memoizeWeak(

const table = tables[`${resourceName}$bypass`];

const permissionsTable = (tables[permissionResourceName] = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you don't assign to tables[permissionResourceName] then all these changes to permissionsTable are essentially noops?

@fisehara fisehara force-pushed the fisehara/fixing-deep-freeze branch from 6675183 to 8efc9f3 Compare April 26, 2023 10:59
@fisehara fisehara requested a review from Page- April 26, 2023 11:00
Actually deep freezing the `constrainedAbstractSqlModel`

Change-type: patch
Signed-off-by: Harald Fischer <[email protected]>
Signed-off-by: fisehara <[email protected]>
@fisehara fisehara force-pushed the fisehara/fixing-deep-freeze branch from 8efc9f3 to d285613 Compare May 4, 2023 18:52
Comment on lines +721 to +723
// `synonyms` is changed later on in the constrainedAbstractSqlModel.symbols get proxy
// `tables` is changed later on in the constrainedAbstractSqlModel.tables get proxy
!['synonyms', 'tables'].includes(prop) &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does the _.cloneDeep in

const constrainedAbstractSqlModel = _.cloneDeep(abstractSqlModel);
not remove the deep-freezing? Because the cloning is intended to avoid hitting issues with modifying the original model which is deep frozen, but if it's not removing the freezing as part of the cloning then that probably needs dealing with

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Page- from my understanding the constrainedAbstractSqlModel should be deep frozen after the deepClone was made.
The freezing part applies to the constrainedAbstractSqlModel and at runtime the Proxies manipulate the dee frozen Object by writing parts to it through the proxies.

So I don't see that the _.cloneDeep is part of the freeze, please correct me here!

@fisehara fisehara requested a review from Page- May 16, 2023 11:38
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