chore(InteractorStyleMPRSlice): fix recursion error in example - #3554
chore(InteractorStyleMPRSlice): fix recursion error in example#3554Jo-Byr wants to merge 1 commit into
Conversation
finetjul
left a comment
There was a problem hiding this comment.
It should be fixed in InteractorStyleMPRSlice instead of the example.
dd8aeba to
2ed5a8a
Compare
There was a problem hiding this comment.
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.
2ed5a8a to
2286a95
Compare
Limit slice widget update in example to prevent recursion error between the controller and interactor style
2286a95 to
476b547
Compare
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)). |
I did this too. The block In InteractorStyleMPRSlice's setSlice is responsible for that. The modification in the example is to fix this problem you mentioned:
|
|
From what I remember, |
The issue actually comes from getSlice not returning the exact same value as setSlice by a few digits, which triggers a set on the controller in the UI, which in turn retriggers setSlice which will again be slightly off. We just need to block the UI update in updateUI: Do you agree ? |
No, I disagree :-) It should not be fixed in the example but in |
It seems just adding |
It is enough for the example, but it may not be enough for other consumers of |
I think that fundamentally, it's an example problem. It's the example that implements a listener that's also a setter, which of course can create a recursion error if we decide to display the data differently from what we get. But with the setter guard mentionned, there's no more erorr in the example. What else would you want to add ? There just seems to be another bug due to the calls to |
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
npm run reformatto have correctly formatted code