Skip to content

Commit

Permalink
add notes about ignored paths (related to hotwired/turbo#1070)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaAwesomeP committed Nov 18, 2023
1 parent 661a229 commit ff6e12d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions _source/handbook/02_drive.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,22 @@ Preload links into Turbo Drive's cache using `<a href="/" data-turbo-preload>Hom
This will make page transitions feel lightning fast by providing a preview of a page even before the first visit. Use it to preload the most important pages in your application. Avoid over usage, as it will lead to loading content that is not needed.

It also dovetails nicely with pages that leverage [Eager-Loading Frames](/reference/frames#eager-loaded-frame) or [Lazy-Loading Frames](/reference/frames#lazy-loaded-frame). As you can preload the structure of the page and show the user a meaningful loading state while the interesting content loads.

## Ignored Paths

Paths with a `.` in the URL will not be handled by Turbo. Turbo will ignore forms and links that target these paths. For example, the following forms would be ignored:

```html
<form action="/messages.67" method="post">
<!-- ignored -->
</form>


<form action="/messages.php" method="post" data-turbo="true">
<!-- also ignored -->
</form>
```

Setting any `data-turbo` methods (including `data-turbo="true"`) will not override or force Turbo to handle a path if it has a `.` in the URL. Paths with a `.` should be reworked on the backend to not include one. Note that some backend frameworks (i.e. Rails) may automatically append parameters/IDs with a `.` such as `/my_path.67`.

<br><br>
2 changes: 1 addition & 1 deletion _source/reference/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: "A reference of everything you can do with element attributes and m

The following data attributes can be applied to elements to customize Turbo's behaviour.

* `data-turbo="false"` disables Turbo Drive on links and forms including descendants. To reenable when an ancestor has opted out, use `data-turbo="true"`. Be careful: when Turbo Drive is disabled, browsers treat link clicks as normal, but [native adapters](/handbook/native) may exit the app.
* `data-turbo="false"` disables Turbo Drive on links and forms including descendants. To reenable when an ancestor has opted out, use `data-turbo="true"`. Be careful: when Turbo Drive is disabled, browsers treat link clicks as normal, but [native adapters](/handbook/native) may exit the app. Note that if Turbo [ignores a path](/handbook/drive#ignored-paths), then setting `data-turbo="true"` will not force/override it to enable.
* `data-turbo-track="reload"` tracks the element's HTML and performs a full page reload when it changes. Typically used to [keep `script` and CSS `link` elements up-to-date](/handbook/drive#reloading-when-assets-change).
* `data-turbo-frame` identifies the Turbo Frame to navigate. Refer to the [Frames documentation](/reference/frames) for further details.
* `data-turbo-action` customizes the [Visit](/handbook/drive#page-navigation-basics) action. Valid values are `replace` or `advance`. Can also be used with Turbo Frames to [promote frame navigations to page visits](/handbook/frames#promoting-a-frame-navigation-to-a-page-visit).
Expand Down

0 comments on commit ff6e12d

Please sign in to comment.