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

Support navigating a Frame to its current src #383

Closed
wants to merge 3 commits into from

Conversation

seanpdoyle
Copy link
Contributor

Rename hasBeenLoaded to willEagerLoad

First, rename hasBeenLoaded to willEagerLoad, and flip the default
from false to true.

Next, set the flag to false if the FrameController is initialized
with a loading="lazy" frame. Finally, set the flag to true once the
element appears in the viewport for the first time.

Support navigating a Frame to its current src

Re-opens #248
Closes #245

Update the FrameController.currentURL from within set sourceURL() to
ensure that currentURL does not still refer to the previous load's
sourceURL.

Replace reloadable attribute with currentURL property

Follow-up to #263

As an alternative to leaking internal FrameController state to the DOM
as the [reloadable] attribute, this commit replaces those assignments
and guard clause checks with references to currentURL instead.

When responding to <a> clicks and <form> submissions, reset the
<turbo-frame> element delegates currentURL = null.

Adding a "public" (that is, package-internal) accessor to the
FrameElementDelegate feels less committal than an end-user facing
[reloadable] attribute, and achieves the same outcome.

First, rename `hasBeenLoaded` to `willEagerLoad`, and flip the default
from `false` to `true`.

Next, set the flag to `false` if the `FrameController` is initialized
with a `loading="lazy"` frame. Finally, set the flag to `true` once the
element appears in the viewport for the first time.
Closes [hotwired#245][]

Update the `FrameController.currentURL` from within `set sourceURL()` to
ensure that `currentURL` does not still refer to the previous load's
`sourceURL`.

[hotwired#245]: hotwired#245
As an alternative to leaking internal `FrameController` state to the DOM
as the `[reloadable]` attribute, this commit replaces those assignments
and guard clause checks with references to `currentURL` instead.

When responding to `<a>` clicks and `<form>` submissions, reset the
`<turbo-frame>` element delegates `currentURL = null`.

Adding a "public" (that is, package-internal) accessor to the
`FrameElementDelegate` feels less committal than an end-user facing
`[reloadable]` attribute, and achieves the same outcome.
@seanpdoyle
Copy link
Contributor Author

Closing in favor of #487.

@seanpdoyle seanpdoyle closed this Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Turbo frame navigation after following a form redirection is break when the URL has been visited before.
1 participant