Skip to content

Releases: adonisjs/inertia

Include module augmentation in config stub

02 Jun 11:44
Compare
Choose a tag to compare

Commits

  • feat: include shared props module augmentation in config stub (47184ff)

Full Changelog: v1.0.0...v1.1.0

v1.0.0

02 Jun 11:31
Compare
Choose a tag to compare

Changes

Now that the hooks assembler and @adonisjs/vite have been stabilised, we can release @adonisjs/inertia with a stable version. No change to the API.

As a reminder, make sure you migrate to the new hooks assembler API: https://github.com/adonisjs/application/releases/tag/v8.3.1

Commits

  • chore: update dependencies (61641f4)

Full Changelog: v1.0.0-29...v1.0.0

InferSharedProps and dynamic root view

01 Jun 22:00
Compare
Choose a tag to compare

Changes

InferSharedProps

One thing that was missing was the ability to have shared props automatically typesafe client side. This is now possible thanks to InferSharedProps. To use it, you'll need to modify your config/inertia.ts configuration file as follows :

import { defineConfig } from '@adonisjs/inertia';
import type { InferSharedProps } from '@adonisjs/inertia/types';

const inertiaConfig = defineConfig({
  sharedData: {
    mySharedData: 'foo'
  },
});

export default inertiaConfig;

declare module '@adonisjs/inertia/types' {
  export interface SharedProps extends InferSharedProps<typeof inertiaConfig> {
    // If necessary, you can also manually add certain
    // shared props, which would be shared from some middleware for example
    manuallyAddedSharedProps: number;
  }
}

Also make sure to include this reference directive in your inertia/app/app.tsx

/// <reference path="../../config/inertia.ts" />

Then, if you are already using InferPageProps the SharedProps will be automatically added to it.

Documentation : https://docs.adonisjs.com/guides/inertia#shared-props

Dynamic root view

Sometimes you may need to define a different root view for another part of your application. Now you can, you can pass a function into the config:

import { defineConfig } from ‘@adonisjs/inertia’

export default defineConfig({
  rootView: ({ request }: HttpContext) => {
    if (request.url().startsWith('/admin')) {
      return 'admin_layout';
    }

    return 'inertia_layout';
  },
})

Starter kit example route

The starter-kit example route will now be available on /, rather than /inertia as this was a source of confusion for some users.

Commits

  • refactor: add starter example route at / (71b8e5e)
  • feat: add InferSharedProps type (388553e)
  • feat: dynamic root view (318d608)
  • chore: update dependencies (dd6e121)
  • test: fix failing test (1192c9a)
  • chore: remove unused import (e4ce29d)

Full Changelog: v1.0.0-28...v1.0.0-29

v1.0.0-28

18 May 13:27
Compare
Choose a tag to compare

Commits

  • fix: usage of SSR bundle on windows (9a16acd)
  • chore: update dependencies (bb2b82a)
  • feat: add directive (6747a27)

Full Changelog: v1.0.0-27...v1.0.0-28

Update dependencies

07 May 16:24
Compare
Choose a tag to compare
  • chore: update dependencies (35bb855)

Full Changelog: v1.0.0-26...v1.0.0-27

Improve InferPageProps

28 Apr 16:02
Compare
Choose a tag to compare

Changes

Mainly improvements for InferPageProps:

  • added support for inertia.lazy : InferPageProps will correctly infer the type of the lazy props
  • Simplified typing output
  • Fixed InferPageProps return when inertia.render is used without page props

Commits

  • refactor: simplify InferPageProps typing (3436c0d)
  • fix: InferPageProps with empty inertia.render method (f1dad28)
  • chore: update dependencies (b8dadbc)
  • feat: support inertia.lazy props via InferPageProps (0732b96)
  • chore: update dependencies (5bfee9d)

Full Changelog: v1.0.0-25...v1.0.0-26

`renderInertia` wrong return type

04 Apr 17:37
Compare
Choose a tag to compare
  • fix: renderInertia returns Route type (d584e25)
  • chore: fix incorrect url (d463e5d)
  • chore: move to release-it instead of np (41d1e80)

Full Changelog: v1.0.0-24...v1.0.0-25

Incorrect @inertiaHead

30 Mar 18:59
Compare
Choose a tag to compare

Commits

  • fix: incorrect head return with @inertiaHead 280a9e3

Full Changelog: v1.0.0-23...v1.0.0-24

Remove FOUC handling

25 Mar 21:50
Compare
Choose a tag to compare

Changes

FOUC handling in development has been removed from adonisjs/inertia and is now managed by adonisjs/vite directly. Make sure you install the latest version of @adonisjs/vite ( 3.0.0-9) if you want to use this version.

Commits

  • fix: move tuyau/utils to prod dependencies 96a1a12
  • refactor: remove FOUC handling 0b25202
  • fix: documentation link by @Bjornvdb in #12

New Contributors

Full Changelog: v1.0.0-22...v1.0.0-23

InferPageProps

24 Mar 18:07
Compare
Choose a tag to compare

Changes

  • Added a InferPageProps type helper for infering page props from a controller class :
// Your Adonis Controller
class MyController {
 index() {
  return inertia.render('foo', { foo: 1 })
 }
}

// Your React/Vue/Solid component
import type { InferPageProps } from '@adonisjs/inertia/types'
import type { MyController } from '../controllers/my_controller.ts'

export default MyFrontendComponent(props: InferPageProps<MyController, 'index'>) { }

Full Changelog: v1.0.0-20...v1.0.0-22