-
Notifications
You must be signed in to change notification settings - Fork 77
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
Accept an array as localesPath
in useLocaleRequired
, withLocaleRequired
, and LocaleRequired
#779
Accept an array as localesPath
in useLocaleRequired
, withLocaleRequired
, and LocaleRequired
#779
Conversation
…accept an array as `localesPath`
@@ -38,7 +38,7 @@ export type LocaleRequiredWrapper = (props: { | |||
*/ | |||
export function withLocaleRequired<Props>( | |||
/** Path containing locale files */ | |||
localePathPart?: LocalePathPartOrThunk, | |||
localePathPart?: LocalePathPartOrThunk | LocalePathPartOrThunk[], |
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.
If you're interested, there's a MaybeMultiple
(or perhaps it was called MaybeArray
) type that you can import and use.
You'll also need to update the server-side code for |
@jpage-godaddy, It seems like serverside, in getInitialProps, we just pass localePathPart directly to Is there some other server-side code I'm missing? |
…equired`, and `LocaleRequired` (#779) * Update useLocalesRequired, withLocaleRequired, and LocaleRequired to accept an array as `localesPath` * Update Unit Tests * Update Docs
Summary
Support passing an array of localePaths to
useLocaleRequired
,withLocaleRequired
, andLocaleRequired
This helps optimize load times by fetching paths in parallel. Previously, consumers had to nest
withLocaleRequired
HOCs in order to ensure fetching of multiple paths, which caused requests to run in series, creating longer page load times.Addresses Issue #776
Changelog
localesPath
inuseLocaleRequired
,withLocaleRequired
, andLocaleRequired
Test Plan
Unit Tests are passing
Have not been able to verify inside an application due to node versioning issues, but we should probably verify this functionality with npm link before merging.