Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export default defineConfig({
text: 'Data & Props',
items: [
{ text: 'Shared data', link: '/guide/shared-data' },
{ text: 'Flash data', link: '/guide/flash-data' },
{ text: 'Partial reloads', link: '/guide/partial-reloads' },
{ text: 'Deferred props', link: '/guide/deferred-props' },
{ text: 'Polling', link: '/guide/polling' },
Expand Down
23 changes: 23 additions & 0 deletions docs/guide/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,29 @@ When set to `true`, an empty `errors: {}` object will always be included in Iner

The default value will be changed to `true` in the next major version.

### `flash_keys`

**Default**: `%i[notice alert]`

@available_since rails=master core=2.3.3

Specifies which Rails flash keys are exposed to the frontend. By default, only known-safe keys (`notice`, `alert`) are included.

```ruby
InertiaRails.configure do |config|
# Default: safe keys only
config.flash_keys = %i[notice alert]

# Add your custom keys
config.flash_keys = %i[notice alert toast message]

# Disable Rails flash integration (use only flash.inertia)
config.flash_keys = nil
end
```

See the [flash data documentation](/guide/flash-data) for more details on using flash with Inertia.

### `parent_controller`

**Default**: `'::ApplicationController'`
Expand Down
47 changes: 47 additions & 0 deletions docs/guide/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,53 @@ router.on('success', (event) => {

The `success` event is not cancelable.

## Flash

@available_since rails=master core=2.3.3

The `flash` event fires when [flash data](/guide/flash-data) is received from the server. This is useful for displaying toast notifications or handling temporary data in a central location.

:::tabs key:frameworks
== Vue

```js
import { router } from '@inertiajs/vue3'

router.on('flash', (event) => {
if (event.detail.flash.toast) {
showToast(event.detail.flash.toast)
}
})
```

== React

```js
import { router } from '@inertiajs/react'

router.on('flash', (event) => {
if (event.detail.flash.toast) {
showToast(event.detail.flash.toast)
}
})
```

== Svelte 4|Svelte 5

```js
import { router } from '@inertiajs/svelte'

router.on('flash', (event) => {
if (event.detail.flash.toast) {
showToast(event.detail.flash.toast)
}
})
```

:::

The `flash` event is not cancelable. [Partial reloads](/guide/partial-reloads) will only trigger the event if the flash data has changed.

## Error

The `error` event fires when validation errors are present on "successful" page visits.
Expand Down
Loading