@W-17543565 implement update routes function#2280
Closed
hajinsuha1 wants to merge 5 commits intofeature/extensibility-v2from
Closed
@W-17543565 implement update routes function#2280hajinsuha1 wants to merge 5 commits intofeature/extensibility-v2from
hajinsuha1 wants to merge 5 commits intofeature/extensibility-v2from
Conversation
hajinsuha1
commented
Feb 21, 2025
| * is configured with, including those defined in the base application and those added by all the extensions. You can use this | ||
| * method to modify these routes in any way you want, but you must return an array of routes as a result. | ||
| */ | ||
| beforeRouteMatch(allRoutes: RouteProps[]): RouteProps[] { |
Collaborator
Author
There was a problem hiding this comment.
@bendvc here is the bulk of the changes where I update the beforeRouteMatch to get the routes from window.__CONFIG__.app.routes if it's client side and allRoutes if it's server
hajinsuha1
commented
Feb 21, 2025
| // console.log('--- beforeRouteMatch in _routes.map:', path, 'componentName:', componentName, 'componentProps:', componentProps) | ||
| // TODO: Pass the components though the configuration | ||
| // - use a js file for configuration to import the files | ||
| const component = Pages[componentName] |
Collaborator
Author
There was a problem hiding this comment.
here is where we map the componentName to the actual component from extension-chakra-storefront/src/pages
bendvc
reviewed
Feb 21, 2025
| beforeRouteMatch(allRoutes: RouteProps[]): RouteProps[] { | ||
| let configuredRoutes: RouteProps[] = [] | ||
|
|
||
| const seoUrlMappingEnabled = true |
Contributor
There was a problem hiding this comment.
@hajinsuha1 Hey Jinsu.. here are some high level general comments.
- My gut is telling me that any kind of logic for serializing/deserializing should be a SDK feature. This means the condition here would be somewhere inside the SDK code rather than in this extension.
- Should we entertain the idea making the routes.jsx and extendRoutes async? That might make our lives easier. We could also infer that if there is an asyn router that we must serialize.
- How do we get the page component map? I think we should be passing this to the extension via a configuration, we can then pass that value to the application component which will later use it when determining the route (we might have to flesh that out a little, but I'm making saying that this handling of serialized routes is also something that would be in the sdk)
- What should be in this extension is an hoc to is used in the extendApp function. That hoc should take advantage of the useBlock hook from the sdk with a special implementation that looks at the seo url mapping api.
- We want to make sure that this extension can accept a commerceAPI config. And also wraps the app with an optional provider like the store locator code is doing.
- The custom code that makes an api called to get the seo mapping should also happen in extendRoutes, I don't thing
beforeRouteMatchis the correct tie in point.
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.
Description
Types of Changes
Changes
How to Test-Drive This PR
Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization