medusa-ui/medusa

Rewrite: Find a way to use fragments with Hydra

Opened this issue · 4 comments

I want to be able to expose fragments to Hydra and let Hydra puzzle together a page based on that.

You would have 1 root page but could have references to other fragments on your page.

In order to render the full page, it would ask Hydra for the render of said fragment. Hydra would direct the ask to the correct service or provide a fallback.

You should be able to expose Attributes from fragments and import them into other fragments.

Read more: https://medusa-ui.github.io/documentation/docs/internals/hydra-flow/#fragments

After a lot of iterations on my side, I think I have a working version - at least for rendering.

Notes:

  • I still need to deal with resources via Hydra
  • I still need to deal with Sessions and exports/imports
  • To deal with the reactive part which is not available in Thymeleaf tags, I need to parse Fragments before the HTML gets passed to Thymeleaf's processor in the renderer.

I have dealt with resources in Hydra.

Added local fragments, and it works currently by merging session together with attributes from the fragment controller.

I don't want that, though - I need to look at the way I can isolate these and let the values persist throughout the session; and also allow export/import into each other.

Fragments would be ideal for component-based work, similar to: https://github.com/EmilStenstrom/django-components
Specifically: You can pass in parameters which define how it is rendered