Avaiga / taipy

Turns Data and AI algorithms into production-ready web applications in no time.
https://www.taipy.io
Apache License 2.0
10.94k stars 775 forks source link

[🐛 BUG] When i try to update app using state function, it does not return dict from userdefined function #1539

Open kurvaraviteja355 opened 1 month ago

kurvaraviteja355 commented 1 month ago

What went wrong? 🤔

I have some user-defined functions that pull data from the API. The API has parameters and it returns dict or list. From the app when i try to update the api parameters, the state object is not return the dict

The code used to update:

def update_budget_data(state):
          total_budget = state.total_budget
         minimum_budget = state.minimum_budget
         channel_1 = state.channel_1
         channel_2 = state.channel_2
         notify(state,  'Optimizing the Budget...')
        state.inputdata = get_budget_data(float(total_budget), float(minimum_budget), float(channel_1), float(channel_2))
        print('Updating initial Budget `data.......')

inputdata returns as <taipy.gui.utils._map_dict._MapDict object at 0x000002B59F30AF50>

How can i get my original dict?

Acceptance Criteria

Code of Conduct

FlorianJacta commented 1 month ago

@kurvaraviteja355 <_MapDict>._dict should return you the original dict. So, your_dict_variable._dict

Should something be done so the developer can have the dict directly and not the _MapDict in its callback? @FredLL-Avaiga @FabienLelaquais

FredLL-Avaiga commented 1 month ago

I suppose we could look into it, yes

kurvaraviteja355 commented 1 month ago

<_MapDict>._dict should return you the original dict. So, your_dict_variable._dict

Thank you its working