You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Background callbacks with different outputs not working #2221
Background callbacks don't work if they are generated with a function/loop. For example, I've created a function gen_callback that creates a new callback given a css id.
The background callback manager uses a hash function to know the key to get. This hash function just takes into account the code of the function, but not the variables used to generate that function.
I have a very similar problem. In case this is useful, I have been using the following workaround for now. I do not know if the workaround breaks any other Dash functionality.
If I am not mistaken, the only time the hash function is called is when registering a function, and this is done only once per function (i.e., only once each time Dash's callback function is invoked). By looking at the code, it seems that the hash is only used as a key to then find the function that must be run when a certain callback is triggered. Thus, it seems that the only purpose of the hash is to assign a unique key each time a function is registered. Since I am not a Dash developer, I can of course be wrong, and please do let me know if I have misunderstood your issue. In any event, the workaround I proposed does work for me.
Activity
LuisScoccola commentedon Sep 13, 2022
I have a very similar problem. In case this is useful, I have been using the following workaround for now. I do not know if the workaround breaks any other Dash functionality.
In the file that defines the Dash app, I added:
daviddavo commentedon Sep 15, 2022
But then it won't be cached, because every time the hash function is called it will return a different uuid.
LuisScoccola commentedon Sep 15, 2022
If I am not mistaken, the only time the hash function is called is when registering a function, and this is done only once per function (i.e., only once each time Dash's callback function is invoked). By looking at the code, it seems that the hash is only used as a key to then find the function that must be run when a certain callback is triggered. Thus, it seems that the only purpose of the hash is to assign a unique key each time a function is registered. Since I am not a Dash developer, I can of course be wrong, and please do let me know if I have misunderstood your issue. In any event, the workaround I proposed does work for me.
daviddavo commentedon Sep 19, 2022
Sorry, I meant that it wouldn't be cached between runs. If you restart the program, the uuids will be different.
hydrusbeta commentedon Jun 25, 2023
Thank you for fixing this issue! I recently ran into this exact problem, and it went away after I updated dash to the latest version.