-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
chore: Move cache
sideEffects to align with other packages
#10562
chore: Move cache
sideEffects to align with other packages
#10562
Conversation
Codecov Report
@@ Coverage Diff @@
## next-major-version/5 #10562 +/- ##
========================================================
+ Coverage 84.65% 84.67% +0.01%
========================================================
Files 195 195
Lines 17439 17438 -1
Branches 3693 3693
========================================================
+ Hits 14763 14765 +2
+ Misses 2597 2594 -3
Partials 79 79
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Looks good!
Thanks @jimblanc 🔥
|
||
/** Always importing Auth when users import Amplify such that | ||
for unauthenticated access (no sign in and sign up), | ||
users don't have to import Auth explicitly **/ | ||
Amplify.Auth = Auth; | ||
Amplify.Cache = Cache; |
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.
Is this technically a breaking change if someone were accessing the Cache via the singleton?
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.
Just making sure we call out this breaking change in v5 changelog
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.
Yep it would be, it'll have to go into the changelog (this usage pattern has been deprecated for a while I believe).
import { Amplify, ConsoleLogger as Logger } from '@aws-amplify/core'; | ||
import AsyncStorage from '@react-native-async-storage/async-storage'; |
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.
✨
Description of changes
This change moves the side effects in
cache
out ofindex.ts
(andreactnative.ts
) to align with the other categories. It also removescache
as a default static member (currently unused) of the Amplify singleton in order to reduce bundle size for use cases that don't directly usecache
. Finally, it removescache
as a dependency ofauth
.Observed bundle size improvements in a barebones CRA app:
Parsed: -15.1 kB
GZipped: -2.06 kB
Issue #, if available
Description of how you validated changes
Local testing.
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.