fix(aws-amplify): preserve library options on partial configure#14815
Open
ShrutiPundir17 wants to merge 5 commits into
Open
fix(aws-amplify): preserve library options on partial configure#14815ShrutiPundir17 wants to merge 5 commits into
ShrutiPundir17 wants to merge 5 commits into
Conversation
Merge existing Amplify.libraryOptions when DefaultAmplify.configure is called with partial libraryOptions after Auth was already set up, so keys like Storage are not dropped. Pin Auth last so default Cognito providers stay intact. Add regression test for Storage + subsequent partial reconfigure (e.g. ssr: true). Use rimraf --glob for clean:size patterns (dual-publish-tmp, tmp*) so clean works on Windows with rimraf v6. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Co-authored-by: Cursor <cursoragent@cursor.com>
3 tasks
ShrutiPundir17
added a commit
to ShrutiPundir17/amplify-js
that referenced
this pull request
May 19, 2026
Remove libraryOptions merge from initSingleton; that belongs in aws-amplify#14815. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge existing Amplify.libraryOptions when DefaultAmplify.configure is called with partial libraryOptions after Auth was already set up, so keys like Storage are not dropped. Pin Auth last so default Cognito providers stay intact.
Add regression test for Storage + subsequent partial reconfigure (e.g. ssr: true).
Use rimraf --glob for clean:size patterns (dual-publish-tmp, tmp*) so clean works on Windows with rimraf v6.
Description of changes
Behavior (
aws-amplify)@aws-amplify/corereplaceslibraryOptionswhenever a new object is passed toAmplify.configure. InDefaultAmplify.configure, after Auth had already been configured with default Cognito providers, a follow-up call with partiallibraryOptions(e.g. only{ ssr: true }) built{ Auth: authLibraryOptions, ...libraryOptions }, which omitted keys that existed only on the previousAmplify.libraryOptions(e.g.Storage).{ ...Amplify.libraryOptions, ...libraryOptions, Auth: authLibraryOptions }so prior category options are preserved, new options apply on top, and
Authis set last so default Cognito providers are not accidentally dropped (includingAuth: undefinedfrom a spread).Tests
initSingletonexpectations to snapshotAuthbeforeconfigurewhere the test mock mutates singleton state.Amplify.libraryOptions, thenconfigure(..., { ssr: true })— asserts Storage, ssr, and Auth are all forwarded toAmplify.configure.Tooling (Windows + rimraf v6)
clean:sizeusedrimraf dual-publish-tmp tmp*without--glob, sotmp*was treated as a literal path and failed on Windows (EINVAL). Updated torimraf --glob dual-publish-tmp tmp*in affected packagepackage.jsonfiles.Issue #, if available
None filed for this specific regression. I can open an issue and link it if maintainers prefer a tracked ticket; otherwise this PR documents the bug and fix.
Description of how you validated changes
packages/aws-amplify—jest __tests__/initSingleton.test.ts(via repo-root hoistedjest). Result: all tests in that file passed, including the new regression.yarn turbo run build --filter=aws-amplify— passed after therimraf --globclean:sizechange (previously failed on Windows during@aws-amplify/coreclean).Full monorepo
yarn testwas not run in this contribution window.Checklist
yarn testpassesChecklist for repo maintainers
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.