Skip to content

Commit

Permalink
on_submission_change called twice with the same status (#2325)
Browse files Browse the repository at this point in the history
* on_submission_change called twice with the same status
resolves #2152

* fix test

* dependency

* compare status identity

---------

Co-authored-by: Fred Lefévère-Laoide <Fred.Lefevere-Laoide@Taipy.io>
  • Loading branch information
FredLL-Avaiga and Fred Lefévère-Laoide authored Dec 12, 2024
1 parent 2e8c6ba commit abe324c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions taipy/gui_core/_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,11 +639,10 @@ def submit_entity(self, state: State, id: str, payload: t.Dict[str, str]):
client_id=self.gui._get_client_id(),
module_context=self.gui._get_locals_context(),
)
client_status = _ClientStatus(self.gui._get_client_id(), submission_entity.submission_status)
client_status = _ClientStatus(self.gui._get_client_id(), None)
with self.submissions_lock:
self.client_submission[submission_entity.id] = client_status
if Config.core.mode == "development":
client_status.submission_status = SubmissionStatus.SUBMITTED
self.submission_status_callback(submission_entity.id)
_GuiCoreContext.__assign_var(state, error_var, "")
except Exception as e:
Expand Down Expand Up @@ -715,7 +714,6 @@ def _get_sort_params(params: t.Optional[t.List[t.Any]] = None, parent: t.Optiona
args.append(None)
return args


def get_sorted_datanode_list(
self,
entities: t.Union[
Expand Down
2 changes: 1 addition & 1 deletion taipy/gui_core/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
@dataclass
class _ClientStatus:
client_id: t.Optional[str]
submission_status: SubmissionStatus
submission_status: t.Optional[SubmissionStatus]
4 changes: 2 additions & 2 deletions tests/gui_core/test_context_is_readable.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from taipy.core.job._job_manager_factory import _JobManagerFactory
from taipy.core.scenario._scenario_manager_factory import _ScenarioManagerFactory
from taipy.core.submission._submission_manager_factory import _SubmissionManagerFactory
from taipy.core.submission.submission import Submission, SubmissionStatus
from taipy.core.submission.submission import Submission
from taipy.core.task._task_manager_factory import _TaskManagerFactory
from taipy.gui import Gui, State
from taipy.gui_core._context import _GuiCoreContext
Expand Down Expand Up @@ -204,7 +204,7 @@ def test_submission_status_callback(self):
mockGui._get_authorization = lambda s: contextlib.nullcontext()
gui_core_context = _GuiCoreContext(mockGui)

gui_core_context.client_submission[a_submission.id] = _ClientStatus("client_id", SubmissionStatus.UNDEFINED)
gui_core_context.client_submission[a_submission.id] = _ClientStatus("client_id", None)
gui_core_context.submission_status_callback(a_submission.id)
mockget.assert_called()
found = False
Expand Down

0 comments on commit abe324c

Please sign in to comment.