Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import / Export (attempt 2) #591

Open
wants to merge 7 commits into
base: rewrite-1.0.0
Choose a base branch
from

Conversation

kevindeyne
Copy link
Member

@kevindeyne kevindeyne commented Dec 10, 2023

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

<m:fragment service="orderService" ref="checkout" exports="postalZipCode, addressLine2 as address" imports="dob, countryOrigin as country">

Fallback info

</m:fragment>

So there are two layers a variable can live:

  • On the parent page
  • Inside the fragment

An export brings an variable from within the fragment to the parent page

An import brings a variable from the parent page into the fragment

Both could be done via an alias, where the name changes as it crosses the layer boundary

Can this work dynamically at all? IE a value from an input in parent determines the outcome of something in the fragment? Unlikely since this is server rendered, but a potentially common usecase, no? Would that matter, because the JS would be cross field anyway, right? Worth writing out as an example, either way.

So components I want to see:

  • Fragment with import: http://localhost:8080/import-fragment

  • Fragment with export: TODO

  • Fragment with JS interaction across boundaries: TODO

  • Progress:

    • The fragment now contains import/export data
    • Next ‘merge’ it somewhere, but where is good? Does it different for import vs export? The session, perhaps?
      • The session sounds good, but does it always stay on the session? IE when you render something … only the imports relevant to the current fragment should be imported
      • So first thing I need to do is ‘break’ it, create a new session when rendering a fragment: DONE
      • Then I need to append to that new session from the main session in case there's an import: DONE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants