This repository has been archived by the owner on May 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
fix(module-map): missing baseUrl to module map on server #206
Merged
Conversation
This file contains 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
📊 Bundle Size Report
|
JAdshead
previously approved these changes
Jun 23, 2020
Francois-Esquire
previously approved these changes
Jun 23, 2020
mtomcal
previously approved these changes
Jun 23, 2020
10xLaCroixDrinker
suggested changes
Jun 23, 2020
...acc, | ||
[moduleName]: { | ||
...moduleBundles, | ||
baseUrl: moduleBundles.baseUrl ? moduleBundles.baseUrl : moduleBundles.node.url.replace(/[^/]+\.js$/i, ''), |
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.
this option should be documented
nellyk
previously approved these changes
Jun 24, 2020
infoxicator
dismissed stale reviews from nellyk, mtomcal, Francois-Esquire, and JAdshead
via
June 24, 2020 16:13
0e758c6
JAdshead
approved these changes
Jun 24, 2020
mtomcal
approved these changes
Jun 24, 2020
Francois-Esquire
approved these changes
Jun 24, 2020
10xLaCroixDrinker
approved these changes
Jun 24, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes an issue where the
baseUrl
key was present on the moduleMap cached sent to the client but not present on the server module map.Description
The baseUrl key is used by
one-app-ducks
to determine the url where the language pack statics are stored. However, when doing Server Side Rendering, the baseUrl is not present and it was falling back to the client rendering to load the language pack (breaking server side rendering) when using eitherloadLanguagePack
orqueryLanguagePack
Motivation and Context
This change fixes this issue by taking the
node
bundle type for each module and creating thebaseUrl
from theurl
in thenode
bundle key.How Has This Been Tested?
This is a non-breaking bugfix that solves an issue with
loadLanguagePack
This solution uses the browser key in the module map which is available on both the clientModuleMapCache and the moduleMap already available on the server.
Tested this solution with
queryLanguageData
and a clean module generated withintl
, the language pack now loads on the server on the first renderComponent rerender: 1
LangpackTest.jsx:16 languageData => {locale: "en-US", greeting: "Welcome to langpack-test from the United States!"}
LangpackTest.jsx:17 isLoading => false
Tested with cultured-frankie and
loadLanguageData
however, even though the language pack loads on the server on the first render, themoduleStatus
property only changes from loading to loaded on the second render, this has been identified as a separate issue and will be addressed on a different PR.Types of Changes
Checklist:
What is the Impact to Developers Using One App?
No expected impact