"Refresh page" if I use Retool.useEventCallback in custom component

I want to setup an event callback in my custom component.

If I define the callback with this code

const onClickEvent = Retool.useEventCallback({
    name: 'OnEventSelect'
})

As soon as I select the custom component on retool I get this error and I have to refresh the page.
(The error for my custom component remains after the refresh)

If I remove that line of code, the component goes back to working perfectly.

NOTE: It's very similar to this topic but that discussion is "closed"

Hey @FrancescoCioria

Have you change the name of the function
image

When you add a component to a Retool app and later change the function name in the code editor, you may sometimes encounter an error.

2 Likes

Hi @FrancescoCioria! Welcome to the community. :slightly_smiling_face:

I've reopened the topic that you linked, as it's pretty clearly describing the same issue. Our team has had a chance to investigate this and there does seem to be an underlying issue, but it's relatively rare and we're not able to conclusively identify the root cause.

We've pushed out an update that will hopefully improve our error handling and give us more insight into what's going on. I'll be sure to provide an update here as soon as I have news to share. :+1:

In the meantime - can you share your index.tsx and package.json files, in addition to the configuration of the component within Retool? Thanks!

1 Like

I'm curious to know if you're still seeing this error, @FrancescoCioria!

No, I somehow made it working
If I remember correctly, I "fixed it" by changing the name fo the component

Thanks for the update, @FrancescoCioria! Don't hesitate to let us know if you run into anything similar in the future. :+1: