verbb / hyper

A Craft CMS plugin for managing links, focusing on user experience.
Other
22 stars 13 forks source link

Matrix in Hyper #184

Open stevendierick opened 1 month ago

stevendierick commented 1 month ago

Describe the bug

A Matrix field in Hyper only works when the Matrix field's view mode is set to As inline-editable blocks. When the view mode is set to either As cards or As an element index it will throw invalid owner errors.

Steps to reproduce

  1. Create a Hyper field
  2. Create a Matrix field
  3. Set view mode of the Matrix field to As cards or As en element index
  4. Add the Matrix field to the Hyper field (under the content or advanced tab)
  5. Add a link to your Hyper field
  6. Add an entry to your Matrix field

Craft CMS version

5.3.4

Plugin version

2.0.4

Multi-site?

Yes

Additional context

No response

engram-design commented 1 month ago

This is correct and unavoidable behaviour for now in Craft 5. This is because non-inline-blocks mode requires the parent owner to be a saved element. Hyper does not use elements for its content to increase performance, particularly for nested content.

I'm looking into alternatives, but right now it would require some PRs to Craft just to suit Hyper, which they may or may not be open to as it's niche and goes against the "everything is an element" approach.

stevendierick commented 1 day ago

I might have encountered another Matrix issue within Hyper. I can't seem to replicate it elsewhere.

It's the same scenario as the original issue, even within the same project. We are using the same Matrix field in Hyper, and we went for inline-editable blocks as you suggested, but we're seeing Axios errors. However, on local development, the functionality still seems to work. On our staging/production environment, though, it doesn't trigger and just times out.

If we start fresh, no errors appear, but the functionality still doesn't work. It continues to work locally, but once you go deeper, Axios errors start showing up.

We have different types of navigations: Hyper-only, Hyper within Matrix, and Matrix within Hyper. The issues are only happening with the Matrix within Hyper setup.

Local example 1: https://share.cleanshot.com/d1pDN6t8fhxvRVb5CxJT Local example 2: https://share.cleanshot.com/jXYxTN5V54C31Grfmrbr

Staging example 1: https://share.cleanshot.com/HRzY5K1gW9BTJsGjxCBy Staging example 2: https://share.cleanshot.com/H0JWY7PqTvq0hXMbWTW5

Any idea what's going on?

Craft CMS version: 5.4.4 Plugin version: 2.0.5 Multi-site? Yes

engram-design commented 23 hours ago

Thanks for those videos. Can you check out the Network requests associated with those (in the Network tab of dev tools) and look at the Preview of those failed requests (the ones in red)? It's showing lots of 400 errors, but keen to know what the returned data is for those requests. It's also tricky to see exactly what requests are failing as the request name is cutoff.

stevendierick commented 22 hours ago

Ah of course, my bad!

1) Local example 1, updating an existing navigation. Errors triggered on load and when going deeper with Matrix: https://share.cleanshot.com/2XRGMkpZ4Cyk5tk3VzpV

2) Local example 2, starting fresh. Everything works but the error is only triggered when going deeper with Matrix: https://share.cleanshot.com/1g828jrpD6y39cxgGwwj

3) Staging example 1, trying to update an existing navigation. Errors triggered on load, can't go any deeper with Matrix: https://share.cleanshot.com/Yts6K4dFn94X9Rf52cyY

4) Staging example 2, starting fresh. Not working and no errors when trying to use the Matrix field: https://share.cleanshot.com/NHqtdKJPGvw1KC9Bplby