adobe / aem-spa-page-model-manager

Interface between Adobe Experience Manager and Single Page Application framework.
Apache License 2.0
33 stars 24 forks source link

SPA - React - Page Model Filter paths not considering in the ModelManager(_fetchActivePageModel ) #56

Closed antoantonyk closed 3 years ago

antoantonyk commented 3 years ago

I created a custom route path(localhost:3000/custom-page) in react project and refer that path in the cq:pagemodel_route_filters meta property to avoid the page model data fetching. This is working as expected when navigating from the home page (or any existing aem pages) to the custom page. If we try to hit the custom page directly(localhost:3000/custom-page), we will get an error as follows.

image

Expected Result: we should able to hit the URL directly without any issues.

After debugging through the code, I think the _fetchActivePageModel method is not checking if the page path is mentioned in the page model route filters or not.

https://github.com/adobe/aem-spa-page-model-manager/blob/f8c4be56fd2b3cb4e2e2f3a251ea63c68129cf1c/src/ModelManager.ts#L333

I created a fix for this: https://github.com/adobe/aem-spa-page-model-manager/compare/master...antoantonyk:issue/fetch-active-page-model-excluded-route-path

antoantonyk commented 3 years ago

@grubyak can you check?