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

[1.x] Ensure Inertia Response generate also compatible with Inertia.js 2 #692

Merged
merged 4 commits into from
Dec 5, 2024

Conversation

crynobone
Copy link
Contributor

@crynobone crynobone commented Nov 28, 2024

This would allow the application to use multiple packages that use both Inertia.js 1 and 2, relying on inertia/inertia-laravel v1 before fully migrating to v2.

Proposal

With these changes, developers can now update their packages to use Inertia.js v2 without including any new specific v2 features, including Defer props, Polling, etc., and set the packages composer.json to "inertia/inertia-laravel": "^1.4|^2.0". This way, applications that still run on Inertia.js v1 can get the latest package releases without being locked into running older package versions or having to upgrade the application to v2 straight away.

Package developers can choose to ignore this options and enforce "inertia/inertia-laravel": "^2.0" to utilise v2 features.

Pros

  • Package developers can safely update npm dependencies to v2.
  • Application developers can get updated packages with the latest v2 without changing their code instead locked to older release due to "inertia/inertia-laravel" version conflict.

Cons

  • Package developers cannot utilize new Inertia 2 features.
  • Encode histories are ignored until inertiajs/inertia-laravel has been updated to v2.

This would allow application to uses multiple packages that use both
Inertia.js 1 and 2 rely can `inertia/inertia-laravel` v1 before fully
migrating to v2.

Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
@crynobone crynobone marked this pull request as ready for review November 28, 2024 07:26
@joetannenbaum
Copy link
Contributor

To clarify this PR after speaking with @crynobone, while the current situation wouldn't actually break anything, if we ever decided to strictly check for a boolean on either of these properties it would break anyone using the 1.x backend library. So we're just putting up some guardrails for the future.

@joetannenbaum joetannenbaum merged commit c30424e into inertiajs:1.x Dec 5, 2024
25 checks passed
@crynobone crynobone deleted the v1-spec branch December 11, 2024 03:25
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.

2 participants