React component doesn't get new props when variable changes

I’m developing a plugin for Garafana, that listens to a variable that is set from the dashboard.
I am able to access it via:
My issue is, that when variable changes I don’t get the new value of the variable (I get it only after refresh).
How do I access the new chosen value from the variable dropdown?

Hello @ilibilibom ,

I have had a similar issue and componentDidUpdate() solved it. Used to store in constructor and then React called componentDidUpdate method when my component’s parent panel was updated.

constructor(props: any) {
    super(props); =;

componentDidUpdate(prevProps) { =;

Thanks @vsergeyev
I’m using functional components, and I used this:

  useEffect(() => {

but it doesn’t work, the useEffect doesn’t get triggered when variable is changed.
Any idea why ?

ok I think I figured out the issue, the request that is sent after variable change is returning a "pending’ response. That’s why it’s not re rendering the component.

@ilibilibom cool you figured it out :slight_smile:

Thanks @vsergeyev :slight_smile:
I have another question,
Is there a way to display a variable dropdown within the panel I’m developing instead of on the top of the dashboard ?