druxt / druxt.js

The Fully Decoupled Drupal Framework
MIT License
112 stars 20 forks source link

Add support for Panels pages #476

Open emdahlstrom opened 2 years ago

emdahlstrom commented 2 years ago

Describe the bug Some routes produce this error message:

Cannot read properties of undefined (reading 'status')

At the same time the following cors-errors are reported:

Access to XMLHttpRequest at 'https://www.djurensratt.se/router/translate-path?path=/engagera-dig/stod-oss' from origin 'https://druxt-prototype.netlify.app' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

www.djurensratt.se/router/translate-path?path=/engagera-dig/stod-oss:1 Failed to load resource: net::ERR_FAILED

Other routes on the site work fine.

However this is a panel page with a bunch of views so there might be a problem with the panel or views system.

Other panel pages give the same result: /engagera-dig, /engagera-dig/bli-aktiv

To Reproduce Steps to reproduce the behavior: Go to this url: https://druxt-prototype.netlify.app/engagera-dig/stod-oss

Or grab our druxt experiment repo, run it and go to the route /engagera-dig/stod-oss

Expected behavior I would expect the route to load but probably with messages from druxt debug about things missing or not being set up right.

Your Environment (please complete the following information):

Additional context The same thing happens in local dev and on netlify static hosting

emdahlstrom commented 2 years ago

I created a panel page containing only a simple text block which gets the same error so it's likely panel pages, not views, that are at fault.

Example url: https://druxt-prototype.netlify.app/demo-simple-panel-page

Decipher commented 2 years ago

Hi @emdahlstrom,

The issue with https://www.djurensratt.se/router/translate-path?path=/engagera-dig/stod-oss is that there's no direct support for Panels pages in the Decoupled Router module (https://www.drupal.org/project/decoupled_router)

I have previously opened an issue with the intent of making the Decoupled Router module more extensible, allow it to better support third party router providers, such as Panels, but I haven't had the time to prioritise the issue yet: https://www.drupal.org/project/decoupled_router/issues/3146024

The issue does have an example of how you can currently extend the routes support, based on the Druxt Drupal module which provides support for Views.

The CORS issue will likely just be a symptom of the unsupported decoupled route.

emdahlstrom commented 2 years ago

@Decipher Excellent, thanks for the clarification!

We're planning to move from Panel Pages to Layout Paragraphs in our project so I'll focus on figuring that out.

I'm not clear on the status of panel pages in the ecosystem these days. I'd guess that Layout Builder will be more popular for site building and Layout Paragraphs for editorial content.