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

Document fragments #794

Open
karneaud opened this issue Jan 28, 2024 · 1 comment
Open

Document fragments #794

karneaud opened this issue Jan 28, 2024 · 1 comment

Comments

@karneaud
Copy link

karneaud commented Jan 28, 2024

Been trying to use document fragments to switch between <screen> but kept getting

Network error: Failed to load request

Then I came across this...

NOTE: Document fragments do not currently work with navigation behaviors, just update behaviors. Future versions of the Hyperview client will support document fragments with navigation behaviors.

In the "document fragment" format, href is an element id prepended by a #. The id must refer to an element in the current document.

For example, assume the following doc is loaded from https://mysite.com/home:

<doc xmlns="https://hyperview.org/hyperview">
  <screen>
    <body>
      <text href="#secondScreen">Hello</text>
    </body>
  </screen>
  <screen id="secondScreen">
    <body>
      <text>Second screen!</text>
      <text href="/test">Test</text>
    </body>
  </screen>
</doc>

When the user presses "Hello", the content for the next screen will be loaded from the doc:

<screen id="secondScreen">
  <body>
    <text>Second screen!</text>
    <text href="/test">Test</text>
  </body>
</screen>

I'm trying to understand what is being said here. Is it that document fragments cannot work in <Navgiation/> scenarios? If so how does this work? How can this work?

flochtililoch added a commit that referenced this issue Jan 29, 2024
Hyperview does not support subsequent screens in navigation by adding the content of these screens in the first document loaded, this is only supported for "loading state" of subsequent screens.
Originally raised in #794.
@flochtililoch
Copy link
Collaborator

Hi @karneaud
Thanks for bringing this to our attention. The scenario you tried implementing is indeed not supported; instead we suggest to provide the content of your second screen via another endpoint and refer to it via a URL.
I've updated the docs in #795 to remove the ambiguous statements, let me know if the docs makes more sense now!

flochtililoch added a commit that referenced this issue Jan 29, 2024
Hyperview does not support subsequent screens in navigation by adding
the content of these screens in the first document loaded, this is only
supported for "loading state" of subsequent screens. Originally raised
in #794.

---------

Co-authored-by: flochtililoch <flochtililoch@gmail.com>
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

No branches or pull requests

2 participants