Skip to content

Add InertiaJS v3 compatibility#193

Closed
gainlinejono wants to merge 9 commits intoinertiaui:mainfrom
gainlinejono:feat/inertia-laravel-v3-support
Closed

Add InertiaJS v3 compatibility#193
gainlinejono wants to merge 9 commits intoinertiaui:mainfrom
gainlinejono:feat/inertia-laravel-v3-support

Conversation

@gainlinejono
Copy link
Copy Markdown

Summary

Enable compatibility with inertiajs/inertia-laravel v3, which replaced Response::resolveProperties() and related methods with a standalone PropsResolver class.

Changes

  • composer.json: Allow inertiajs/inertia-laravel ^3.0.
  • Support.php: Add isInertiaV3() detection (via PropsResolver class existence) and update isInertiaV2() to exclude v3.
  • ModalServiceProvider.php: When running with Inertia v3, use PropsResolver to resolve props and metadata in the Response::toArray() macro.
  • Modal.php: Expand extractMeta() to handle v3 metadata keys (prependProps, deepMergeProps, matchPropsOn, scrollProps, onceProps, sharedProps) while retaining v2 keys.
  • DispatchBaseUrlRequest.php: Copy the original request's session onto the subrequest so middleware that depends on the session store doesn't throw a RuntimeException.
  • Context
  • In inertia-laravel v3, Response::resolveProperties(), resolveMergeProps(), and resolveDeferredProps() were removed. Prop resolution now happens through Inertia\PropsResolver. Without this change, opening a modal throws BadMethodCallException: Method Inertia\Response::resolveProperties does not exist.

The session fix addresses a separate issue where DispatchBaseUrlRequest creates an internal subrequest that lacks the session store, causing RuntimeException: Session store not set on request.

gainlinejono and others added 7 commits March 7, 2026 23:50
Enable compatibility with Inertia v3 and improve request handling.

- composer.json: allow inertiajs/inertia-laravel ^3.0.
- Support.php: add isInertiaV3() and make isInertiaV2() aware of v3.
- ModalServiceProvider.php: when running with Inertia v3, use PropsResolver to resolve props and meta in Response::toArray().
- Modal.php: expand meta keys checked to include Inertia v3 keys (prependProps, deepMergeProps, matchPropsOn, scrollProps, onceProps, sharedProps) while retaining v2 keys.
- DispatchBaseUrlRequest.php: copy the original request's session onto the temporary base-url request so middleware that runs before StartSession can access the session without errors.

These changes ensure proper prop/meta resolution for Inertia v3 and prevent session-related errors when dispatching internal requests.
@jeffreyvanhees
Copy link
Copy Markdown

jeffreyvanhees commented Mar 23, 2026

Any updates on this @pascalbaljet? I'd like to upgrade to InertiaJS 3 but this is blocking me :)

Comment thread vue/package.json Outdated
Comment thread vue/package.json Outdated
gainlinejono and others added 2 commits March 26, 2026 00:04
Co-authored-by: Jayan Ratna <30396013+jayan-blutui@users.noreply.github.com>
Co-authored-by: Jayan Ratna <30396013+jayan-blutui@users.noreply.github.com>
Comment thread react/package.json
"@headlessui/react": "^2.1.0",
"@heroicons/react": "^2.1.4",
"@inertiajs/react": "^1.3.0||^2.1.11",
"@inertiajs/react": "^1.3.0||^2.1.11||^3.0.0-beta",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"@inertiajs/react": "^1.3.0||^2.1.11||^3.0.0-beta",
"@inertiajs/react": "^1.3.0||^2.1.11||^3.0.0",

@shankhadevpadam
Copy link
Copy Markdown

Please release the new version to support Inertia version 3 @pascalbaljet

@erickreutz
Copy link
Copy Markdown

any update on this? would like to update as well.

@pascalbaljet
Copy link
Copy Markdown
Contributor

Thanks for this! I'm closing this one in favor of #201 so we can take full advantage of Inertia 3.

@gainlinejono gainlinejono deleted the feat/inertia-laravel-v3-support branch March 27, 2026 07:24
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.

6 participants