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

New feature: Frames #1565

Closed
wants to merge 29 commits into from
Closed

New feature: Frames #1565

wants to merge 29 commits into from

Conversation

buhrmi
Copy link
Contributor

@buhrmi buhrmi commented May 24, 2023

My hope for this PR is to serve as a proof-of-concept to implement modals via a new feature I'd like to call Inertia Frames. An Inertia Frame is similar to standard browser <iframe>: By default, all user navigation and form submissions are encapsulated within a frame.

An example usage looks like this:

<script>
import { Frame } from '@inertiajs/svelte`
</script>

<div class="modal">
  <Frame src="/session/new" id="login">
    Loading...
  </Frame>
</div>

When a Frame component is mounted into the page, it makes an Inertia Visit to the path specified in the src attribute. The Visit is made with a new attribute introduced in this PR: router.visit(src, {frameId: "login"}. When the router makes a visit with a specified frameId, it does not update the "global" page component, but the component within the Frame. The id attribute on the is optional. If not specified, a random frameId is used.

I just started work on the implementation for the Svelte adapter and would like to keep working on this until an "official" or better implementation/concept for modals emerges. I don't really expect this PR to get merged any time soon, but I do hope to ignite some discussion about modals again.

@jefhar
Copy link

jefhar commented May 24, 2023

I would be interested in seeing how this concept works inside the <dialog> element.

@buhrmi
Copy link
Contributor Author

buhrmi commented May 24, 2023

<dialog open>
  <Frame src="/stuff/2/edit">Loading</Frame>
</dialog>

@driesvints
Copy link
Contributor

@buhrmi if you want a review please make sure to mark the PR as ready.

@buhrmi
Copy link
Contributor Author

buhrmi commented Apr 8, 2024

This is just an experimental proof of concept. Sorry I didn't have any expectations of it actually getting considered.

@buhrmi buhrmi closed this Apr 8, 2024
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

4 participants