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.

@Jo-Byr
Jo-Byr force-pushed the fix-interactor-style-mpr-slice-example branch from dd8aeba to 2ed5a8a Compare July 16, 2026 13:32
Comment thread Sources/Interaction/Style/InteractorStyleMPRSlice/index.js Outdated

@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.

Comment thread Sources/Interaction/Style/InteractorStyleMPRSlice/index.js Outdated
@Jo-Byr
Jo-Byr force-pushed the fix-interactor-style-mpr-slice-example branch from 2ed5a8a to 2286a95 Compare July 20, 2026 06:27
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 2286a95 to 476b547 Compare July 20, 2026 06:39
@Jo-Byr

Jo-Byr commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

A proper fix should be to prevent such notification while the camera is being updated.

I moved the first updateUI call and the istyle.onModified callback to after the first render call.

@finetjul

Copy link
Copy Markdown
Member

A proper fix should be to prevent such notification while the camera is being updated.
I moved the first updateUI call and the istyle.onModified callback to after the first render call.

While you may have fixed the example. You have not fixed all the consumers of InteractorStyleMPRSlice. It would be better to fix InteractorStyleMPRSlice in the first place (rather than the example (i.e. a consumer of InteractorStyleMPRSlice)).

@Jo-Byr

Jo-Byr commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

While you may have fixed the example. You have not fixed all the consumers of InteractorStyleMPRSlice. It would be better to fix InteractorStyleMPRSlice in the first place (rather than the example (i.e. a consumer of InteractorStyleMPRSlice)).

I did this too. The block

if (publicAPI.getSlice() === slice) {
  return false;
}

In InteractorStyleMPRSlice's setSlice is responsible for that.

The modification in the example is to fix this problem you mentioned:

A proper fix should be to prevent such notification while the camera is being updated.

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