Skip to content

Commit

Permalink
on_submission_change called twice with the same status
Browse files Browse the repository at this point in the history
resolves #2152
  • Loading branch information
Fred Lefévère-Laoide authored and Fred Lefévère-Laoide committed Dec 12, 2024
1 parent 2e8c6ba commit a8a67e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions taipy/gui_core/_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ def submission_status_callback(self, submission_id: t.Optional[str] = None, even
)
payload.update(tasks=running_tasks)

if last_client_status.submission_status is not new_status:
if (
last_client_status.submission_status is None
or last_client_status.submission_status.value < new_status.value
):
# callback
submission_name = submission.properties.get("on_submission")
if submission_name:
Expand Down Expand Up @@ -639,11 +642,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 +717,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]

0 comments on commit a8a67e4

Please sign in to comment.