Skip to content

chore(InteractorStyleMPRSlice): fix recursion error in example#3554

Open
Jo-Byr wants to merge 1 commit into
Kitware:masterfrom
Jo-Byr:fix-interactor-style-mpr-slice-example
Open

chore(InteractorStyleMPRSlice): fix recursion error in example#3554
Jo-Byr wants to merge 1 commit into
Kitware:masterfrom
Jo-Byr:fix-interactor-style-mpr-slice-example

Conversation

@Jo-Byr

@Jo-Byr Jo-Byr commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Context

InteractorStyleMPRSlice example fails due to a recursion error.

Results

The error is fixed so the example works.

Changes

Added a difference threshold on the interactor Stume slice update to avoid recursion error

PR and Code Checklist

  • semantic-release commit messages
  • Run npm run reformat to have correctly formatted code

@Jo-Byr
Jo-Byr requested a review from finetjul July 16, 2026 11:01
@Jo-Byr Jo-Byr self-assigned this Jul 16, 2026

@finetjul finetjul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be fixed in InteractorStyleMPRSlice instead of the example.

Limit slice widget update in example to prevent recursion
error between the controller and interactor style
@Jo-Byr
Jo-Byr force-pushed the fix-interactor-style-mpr-slice-example branch from dd8aeba to 2ed5a8a Compare July 16, 2026 13:32
};

publicAPI.setSlice = (slice) => {
if (publicAPI.getSlice() == slice) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=== non ?

@finetjul finetjul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm glad this fixes the example.
However, I think it does not fix the root of the problem.
The InteractorStyleMPRSlice is temporarilly notifying observers of an invalid "slice".
The problem is that it triggers a modify event between line 174 and line 175. When the state is unstable.
A proper fix should be to prevent such notification while the camera is being updated.


publicAPI.setSlice = (slice) => {
if (publicAPI.getSlice() == slice) {
return;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be great, to be consistent with other setters, that it returns "false" when slices are similar. And "true" if they are different.

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.

3 participants