# Upgrading plugin 7.6.2 to 7.7.0 : vis.updateState() does not trigger requestHandler anymore

**URL:** <https://discuss.elastic.co/t/upgrading-plugin-7-6-2-to-7-7-0-vis-updatestate-does-not-trigger-requesthandler-anymore/236031>\
**Category:** Kibana\
**Created:** [June 6, 2020, 11:05am UTC](https://discuss.elastic.co/t/upgrading-plugin-7-6-2-to-7-7-0-vis-updatestate-does-not-trigger-requesthandler-anymore/236031 "2020-06-06T11:05:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![guitoo](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@guitoo](https://discuss.elastic.co/u/guitoo)\
**Post date:** [June 6, 2020, 11:05am UTC](https://discuss.elastic.co/t/upgrading-plugin-7-6-2-to-7-7-0-vis-updatestate-does-not-trigger-requesthandler-anymore/236031/1 "2020-06-06T11:05:21Z")

</div>

Hello

I have developed a working simple visualization plugin in v7.6, based on the legacy plugin development framework. On version v7.6, a component UI change `props.vis.updateState()` does trigger requestHandler function, as expected.

> <https://github.com/guyplusplus/Kibana-Plugin-Custom-Form-Filter-Visualization-Legacy/blob/master/kbn_tp_custom_form_filter_accounts/public/custom_form_filter_accounts_vis/custom_form_filter_accounts_components.js#L58>

After upgrade to 7.7 using the new plugin dev framework, the very same code does not trigger any requestHandler call anymore.

> <https://github.com/guyplusplus/Kibana-Plugin-Custom-Form-Filter-Visualization/blob/master/vis_type_custom_form_filter_accounts/public/custom_form_filter_accounts_vis_controller.tsx#L58>

How can the UI component can trigger a requestHandler call?

Thank you very much.

guy

---

<div class="post-metadata">

**Author:** ![ppisljar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppisljar/32/11588_2.png) [@ppisljar](https://discuss.elastic.co/u/ppisljar)\
**Post date:** [June 16, 2020, 9:42am UTC](https://discuss.elastic.co/t/upgrading-plugin-7-6-2-to-7-7-0-vis-updatestate-does-not-trigger-requesthandler-anymore/236031/2 "2020-06-16T09:42:55Z")

</div>

you need to do a few things:

- add toExpression property to your visualization definition which should be an async function accepting vis as first parameter and params as second parameter. it needs to return expression string. something like this:

```auto
toExpression: async (vis, params) => {
  return `yourReqHandlerFunction param1=${vis.params.something } param2=${vis.data.searchsource.filter}` | your_vis_function param1=${vis.params.something} x={vis_dimension 0}`
},

```

- write your expression function for request handler and register it with expression service
- write your expression function for your visualization and register it with expression service
- write renderer for your visualization and register it with expression service

best to take a look at some of our code:

- build\_pipeline.ts --\> builds expression strings for our build in charts, and calls toExpression for third party charts (that's currently the only way to get your own request handler working, but we are in the middle of refactoring so things will keep changing during 7.x)
- vis\_type\_metric which registers chart expression function (metric\_vis\_fn.ts)
- data/public/search/expressions/esaggs.ts is our default 'request handler' (by the way we are in the process of adding another one that will allow you to do raw es queries + there is essql in basic so maybe you can use one of the existing data fetching functions ?
- [https://github.com/elastic/kibana/pull/57694](https://github.com/elastic/kibana/pull/57694) as a sample renderer for metric vis, note that its still early work in progress.

after we are done with refactorings we will provide blogs that will help you go thru the migration but currently things are very likely to change.

---

<div class="post-metadata">

**Author:** ![guitoo](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@guitoo](https://discuss.elastic.co/u/guitoo)\
**Post date:** [June 21, 2020, 11:32am UTC](https://discuss.elastic.co/t/upgrading-plugin-7-6-2-to-7-7-0-vis-updatestate-does-not-trigger-requesthandler-anymore/236031/3 "2020-06-21T11:32:50Z")

</div>

Peter,

Excellent information, thank you.

For the short term, I changed my approach by using the 'data' service to access the query filter. I just released my plugin fully NP, working on 7.8.0!

Back to the Expression service, is there is high level conceptual documentation? For example I read the markdown\_fn.ts code, it is very difficult for me to understand how it behaves and the APIs and concepts behind. It looks fairly similar in purpose to markdown\_vis.ts...

Thank you again !

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 19, 2020, 11:32am UTC](https://discuss.elastic.co/t/upgrading-plugin-7-6-2-to-7-7-0-vis-updatestate-does-not-trigger-requesthandler-anymore/236031/4 "2020-07-19T11:32:53Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
