You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created an interception using the intercept function and called another function inside, which removes another interception on the same locale. This looks something like this:
The destroy method of the listStore removes an interception on the this.locale reference. And this seems to happen during MobX iterates over all the interceptions, which finally results in the following error:
Uncaught TypeError: interceptors[i] is not a function
at interceptChange$$1 (mobx.module.js?8b18:2802)
at ObservableValue$$1.prepareNewValue (mobx.module.js?8b18:774)
at ObservableValue$$1.set (mobx.module.js?8b18:755)
at ResourceStore.setLocale (ResourceStore.js?1b9b:108)
at executeAction$$1 (mobx.module.js?8b18:649)
at ResourceStore.res (mobx.module.js?8b18:640)
at Object.onChange (MediaDetails.js?013a:193)
at Object.Select._this.handleOptionClick [as onOptionClick] (Select.js?f6a9:56)
at OptionList._this.handleOptionClick (OptionList.js?7462:23)
at Option._this.handleOnClick (Option.js?f8b9:24)
This makes totally sense, once you got your head around it, but it took me some time and debugging to get there. I know that removing stuff from a collection while iterating over it is a very common problem, and could totally understand if you say that it should not be supported. However, the error was not very helpful, so I would at least expect an error saying that disposing interceptions in an interception is not supported.
Or, if there is no reason to not support it, I found this stackoverflow answer describing a solution. I could also imagine to provide a PR implementing that, since it does not seem a change that hard.
The text was updated successfully, but these errors were encountered:
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.
lockbot
locked as resolved and limited conversation to collaborators
Dec 15, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have created an interception using the
intercept
function and called another function inside, which removes another interception on the same locale. This looks something like this:The
destroy
method of thelistStore
removes an interception on thethis.locale
reference. And this seems to happen during MobX iterates over all the interceptions, which finally results in the following error:This makes totally sense, once you got your head around it, but it took me some time and debugging to get there. I know that removing stuff from a collection while iterating over it is a very common problem, and could totally understand if you say that it should not be supported. However, the error was not very helpful, so I would at least expect an error saying that disposing interceptions in an interception is not supported.
Or, if there is no reason to not support it, I found this stackoverflow answer describing a solution. I could also imagine to provide a PR implementing that, since it does not seem a change that hard.
The text was updated successfully, but these errors were encountered: