I have an element in my app that exists to contain a list of tooltips for elements defined elsewhere.
dhtml.P(children=[], id='Tooltips'),
I recently added the option to delete the element the tooltip is attached to and, for garbage cleaning purposes, remove the associated tooltips.
#The output arg in the callback declaration for the above element
Output('TimelineComments', 'data', allow_duplicate=True)],
...
#The state arg in the callback that retrieves the existing tooltip list
State('Tooltips', 'children')
...
toPop = []
for i in range(0, len(tooltips)):
if tooltips[i]['props']['target']['tier'] == SelectedTier: #This condition creates a list of tooltips to delete
toPop.append(i)
elif tooltips[i]['props']['target']['tier'] > SelectedTier: #This condition amends the id of some other tooltips (not sure if this is related)
tooltips[i]['props']['target']['tier'] = tooltips[i]['props']['target']['tier']-1
for i in range(0, len(toPop)): #Then delete the tooltips at the indices in the array
del tooltips[i]
I’ve been encountering an error after i try to handle this list in following functions where the list of tooltips has some non-tooltip items appended. See Photo from debug
Anyone know why this is happening and how to stop it?