Popover warning

What I’m trying to do:
Recently my app has started logging a warning message for popovers. Whenever a page with popovers loads it prints this warning for each popover in the form.

Warning: creating a popover on a componet which already has a popover.
Destroy the popover before creating a new one.

What I’ve tried and what’s not working:

Code Sample:

# this is a formatted code snippet.
# paste your code between ``` 

Clone link:
share a copy of your app

Yeap - it’s new.

When you create a popover on a component that already has one,
then the new popover is just ignored - which is probably not what you want.

So either - you don’t need to create this popover because you already did.
Or you should call self.my_button.pop('destroy') before creating a new one.

(and just like - Anvil Extras Tabs format issue for more discussion/questions/suggestions it might be worth raising an issue at https://github.com/anvilistas/anvil-extras/issues)

I’m using them on a repeating panel form. Are you saying that it should only be loading once instead of for each instance of that repeating panel form? This has always worked before and just recently started to occur?

What does this mean exactly?
You didn’t used to get the warning?
Or replacing a popover always displayed the new content?

The reason for the new warning is that when I was doing some recent testing, I found that the following didn’t work.

self.my_button.popover('foo')
self.my_button.popover('bar')
# changing to bar had no effect - foo was still displayed

self.my_button.popover('foo')
self.my_button.pop('destroy')
self.my_button.popover('bar')
# works as expected

I double checked and can confirm this is the behaviour i’m seeing.

Probably worth posting a code snippet showing how you’re creating the popovers and what you’re expecting to happen vs what you’re seeing.

Sorry, I had never gotten the message until recently. I have a custom function that sets the popover on the form show event. It only loads it once and I was never changing it to something else, yet was still getting the message. I have implement you “destroy” method and that seemed to clear it up.

Here is an example of how I set the popovers:

def set_pop_overs(self, **event_args):
    with anvil.server.no_loading_indicator:
      cust_form = CustomerDetailsPop(item=self.item)
      self.link_name.pop('destroy')  # I recently added this line
      self.link_name.popover(cust_form, placement='bottom', trigger='hover', delay={ "show": 100, "hide": 100 }, auto_dismiss=False)    

def show_form(self, **event_args):
    """This method is called when the data row panel is shown on the screen"""
    self.set_pop_overs()