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

UI-9409 - Fix Error: Cannot perform 'get' on a proxy that has been revoked when attempting to migrate while removing widgets #125

Merged
merged 4 commits into from
May 31, 2024

Conversation

NZepeda
Copy link
Contributor

@NZepeda NZepeda commented May 14, 2024

Summary

The issue is described in this ticket: https://activeviam.atlassian.net/browse/UI-9409.

Problem

The problem is that when attempting to run the migration script, the following error is thrown: "TypeError: Cannot perform 'get' on a proxy that has been revoked". This is caused by immer's produce function. Unfortunately, I'm not 100% why this error is being thrown in the first place. The fix I went for was to remove that produce function, extract the logic into a function and add a test for it.

@NZepeda NZepeda changed the title Fix TypeError: Cannot perform 'get' on a proxy that has been revoked when attempting to migrate while removing widgets UI-9409 - Fix Error: Cannot perform 'get' on a proxy that has been revoked when attempting to migrate while removing widgets May 14, 2024
@NZepeda NZepeda marked this pull request as ready for review May 14, 2024 20:59
Copy link
Collaborator

@antoinetissier antoinetissier left a comment

Choose a reason for hiding this comment

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

@NZepeda there seems to be an install/build error in the CI.
Can you look into it ?

For the implementation, I would prefer to understand what the issue is.
The local stacktrace on the test case might help already.
My guess is: as widgets are removed, maybe the layout gets modified and some nested part of the layout gets removed, and then there is a failure when trying to access it in the next widgets.

@NZepeda
Copy link
Contributor Author

NZepeda commented May 16, 2024

@NZepeda there seems to be an install/build error in the CI.
Can you look into it ?

@antoinetissier I just reran the CI checks from failed, it was some issue related to npm, looks like it's resolved now.

For the implementation, I would prefer to understand what the issue is.
The local stacktrace on the test case might help already.
My guess is: as widgets are removed, maybe the layout gets modified and some nested part of the layout gets removed, and then there is a failure when trying to access it in the next widgets.

I'll dig some more, I'm not sure if that's the case because the error doesn't happen until the following line:

content: JSON.stringify(_omit(migratedDashboard, ["name"])),

So it doesn't seem to be an issue with attempting to access a missing property.

@antoinetissier
Copy link
Collaborator

@NZepeda have you been able to investigate more ?

@NZepeda
Copy link
Contributor Author

NZepeda commented May 30, 2024

@antoinetissier Yes, the issue seems to be this double usage of the produce function. It seems to be causing a "proxy leak" where the returned dashboardWithWidgetsRemoved object still contains a property that is a Proxy. This causes the error we're seeing TypeError: Cannot perform 'get' on a proxy that has been revoked. Like I did on this PR, removing the usage of the produce function here fixes the issue. I actually created a dummy PR in the Atoti-UI repo where I added two tests, one using the produce function and the other not and I'm able to reproduce the error. The test using the produce function throws the same error while the other passes as expected. I haven't had the chance to pinpoint exactly why this is happening yet.

@antoinetissier antoinetissier merged commit 21d9d84 into main May 31, 2024
2 checks passed
@antoinetissier antoinetissier deleted the bugfix/UI-9409 branch May 31, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants