Skip to content

feat(state): add change listener suppression context manager#79

Merged
jourdain merged 2 commits intoKitware:masterfrom
Thibault-Pelletier:suppress-change-listeners
May 5, 2026
Merged

feat(state): add change listener suppression context manager#79
jourdain merged 2 commits intoKitware:masterfrom
Thibault-Pelletier:suppress-change-listeners

Conversation

@Thibault-Pelletier
Copy link
Copy Markdown
Contributor

Adds a context manager to suppress change listener callbacks on the server in its scope. Allows to avoid unwanted backend callbacks when only a client state update is wanted.

@Thibault-Pelletier Thibault-Pelletier force-pushed the suppress-change-listeners branch from 53abedb to 97e1ed1 Compare April 27, 2026 15:01
@Thibault-Pelletier Thibault-Pelletier marked this pull request as draft April 27, 2026 16:04
@Thibault-Pelletier
Copy link
Copy Markdown
Contributor Author

For information, I will add an additional commit to support the suppress change to the typed state as well (forgot to implement that)

@Thibault-Pelletier Thibault-Pelletier marked this pull request as ready for review April 27, 2026 16:16
@Thibault-Pelletier
Copy link
Copy Markdown
Contributor Author

@jourdain I have kept two independent commits for the state / typed_state. Let me know if I should squash (or if you have any feedbacks on this PR of course!

Comment thread trame_server/state.py Outdated
Comment thread src/trame_server/state.py
Comment thread trame_server/state.py Outdated
@Thibault-Pelletier Thibault-Pelletier force-pushed the suppress-change-listeners branch from 5c659be to ee5101c Compare April 28, 2026 05:46
@jourdain
Copy link
Copy Markdown
Collaborator

jourdain commented May 5, 2026

Seems good. I can't focus enough to follow all the details, but the code looks good to me.

@jourdain
Copy link
Copy Markdown
Collaborator

jourdain commented May 5, 2026

But you need to rebase and fix the conflicts.

Adds a context manager to suppress change listener callbacks on the server
in its scope. Allows to avoid unwanted backend callbacks when only
a client state update is wanted.
Add suppress_change_listeners context manager to the TypedState to suppress
any bound callback to any of the typed state field from being triggered in
its context.
@Thibault-Pelletier Thibault-Pelletier force-pushed the suppress-change-listeners branch from ee5101c to a8f52a1 Compare May 5, 2026 09:11
@Thibault-Pelletier Thibault-Pelletier marked this pull request as draft May 5, 2026 10:05
@Thibault-Pelletier
Copy link
Copy Markdown
Contributor Author

@jourdain, thx for the ping.
I just rebased the branch and it should be good.

For information, I have stumbled on a flakky test in trame-slicer and I'm checking to see if the suppress change can resolve it in practice.

I'll let you know once I've run a few tests

@jourdain
Copy link
Copy Markdown
Collaborator

jourdain commented May 5, 2026

I'm ok to merge if you think it is good to go. But you will have to remove the "draft" state.

@Thibault-Pelletier Thibault-Pelletier marked this pull request as ready for review May 5, 2026 15:54
@Thibault-Pelletier
Copy link
Copy Markdown
Contributor Author

After playing a while, my problem was unrelated to anything the supress_listener can solve...

I think the PR is good to go as it is.
In the coming weeks, I'll plug it into trame-slicer and give it a bigger test run !

@jourdain jourdain merged commit b301128 into Kitware:master May 5, 2026
5 checks passed
@Thibault-Pelletier Thibault-Pelletier deleted the suppress-change-listeners branch May 7, 2026 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants