-
Notifications
You must be signed in to change notification settings - Fork 318
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
Vue: Fix memory allocation for useAuthenticator composable #1052
Conversation
🦋 Changeset detectedLatest commit: c71c4a4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is automatically being deployed by Amplify Hosting (learn more). |
@@ -3,6 +3,7 @@ import { ref, reactive, Ref, watchEffect } from 'vue'; | |||
import { getServiceFacade } from '@aws-amplify/ui'; | |||
import { facade } from './useUtils'; | |||
import { InterpretService } from '@/components'; | |||
import { createSharedComposable } from '@vueuse/core'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an awesome library 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is! Lot's of great utilities in it!
This pull request is automatically being deployed by Amplify Hosting (learn more). |
Mind adding a little more detail in the description as to how this improves memory useage? Link to blog article or something? |
@reesscot I showed a pattern of using external composables on my YouTube channel and a commenter mentioned that I should look into how memory is being affected, since he's seen memory leaks with composables that use reactive properties. After further research I learned about effectScope and how it helps solve this problem by disposing I then looked at how the popular VueUse library was creating it's composables. It was using After adding this into our Vue code base, it seemed that the |
Issue #, if available:
#1050
Description of changes:
Added wrapper to handle memory better when reusing the
useAuthenticator
composable in multiple vue instances.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.