# Aurelia 2 State plugin action handler \`action\` parameter

**URL:** <https://discourse.aurelia.io/t/aurelia-2-state-plugin-action-handler-action-parameter/5132>\
**Category:** Uncategorized\
**Created:** [March 24, 2023, 2:14pm UTC](https://discourse.aurelia.io/t/aurelia-2-state-plugin-action-handler-action-parameter/5132 "2023-03-24T14:14:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![frmjp](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@frmjp](https://discourse.aurelia.io/u/frmjp)\
**Post date:** [March 24, 2023, 2:14pm UTC](https://discourse.aurelia.io/t/aurelia-2-state-plugin-action-handler-action-parameter/5132/1 "2023-03-24T14:14:50Z")

</div>

Hi! I am using Aurelia 2 State plugin (ESNext).

I reproced an example from the docs:

```auto
// initial-state.js
export const initialState = {
  keywords: '',
};

// action-handlers.js
export function keywordsHandler(currentState, action) {
  console.log('action:', action);
  return action.type === 'newKeywords'
    ? { ...currentState, keywords: action.value }
    : currentState;
}

// main.js
import { StateDefaultConfiguration } from '@aurelia/state';
import Aurelia from 'aurelia';
import { keywordsHandler } from './action-handlers';
import { initialState } from './initial-state';
import { MyApp } from './my-app';

Aurelia.register(StateDefaultConfiguration.init(initialState, keywordsHandler))
  .app(MyApp)
  .start();

// my-app.html
<input
  value.state="keywords"
  input.dispatch="{ type: 'newKeywords', value: $event.target.value }"
/>

```

Well, whenever I type on the `<input>`, what I get on console is: “action: newKeywords”, meaning that I am getting `action.type` instead of `action` as the second argument to my action handler.

Is there a bug there, or what? Please help.

Thanks!

---

<div class="post-metadata">

**Author:** ![bigopon](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/bigopon/32/18_2.png) [@bigopon](https://discourse.aurelia.io/u/bigopon)\
**Post date:** [March 24, 2023, 9:00pm UTC](https://discourse.aurelia.io/t/aurelia-2-state-plugin-action-handler-action-parameter/5132/2 "2023-03-24T21:00:27Z")

</div>

It’s recently changed here [https://github.com/aurelia/aurelia/pull/1709](https://github.com/aurelia/aurelia/pull/1709)

And will be out in beta-3. Our doc is ahead of our beta release. For now, it’ll be still `(state, action, ...params)`. We will be doing a beta 3 release soon.
