-
Notifications
You must be signed in to change notification settings - Fork 728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Carousel - Filter duplicates and swallow exceptions #386
Comments
Yep :) EpoxyController#setFilterDuplicates we actually enable this in all our controllers (via a base controller) but we also implement Our main source of this issue is in API quirks that are hard to control for and we don't want prod crashing for that |
@elihart I'm actually talking about the Carousel. It extends from EpoxyRecyclerView AFAIK which uses EpoxyController, but I can't seem to be able to access that instance of EpoxyController that's being used on the Carousel. As for crashes in production, the Carousel does crash here: I'm using an extended version of |
Maybe since I'm already extending from
Would that help enabling the exception swallowing in case of duplicates? |
Yeah, so there are two ways to use the Carousel, either setting your own controller or setting a list of models. If you use the carousel via CarouselModel_ you can only set a list of models. Anyway, I was thinking of the case where you set your own EpoxyController, in which case you would have access to your override approach should work. The controller is only ever assigned via the Here is a general fix I have in mind:
So by default duplicates would not crash, but a handler could be set up on app init if you want to crash in debug or log in prod. Thoughts? |
Yeah, I'm not setting my own EpoxyController, so the override approach seems to be the way to go. I just released a new prod version today, so far so good. I'll wait a day or two for adoption before calling it a victory though. As for the fixes you have in mind, the second one seems to be extremely useful, specially when you have plenty of controllers and you want the same error handling behavior in all of them (that would be my scenario for example. I throw when on dev and just log when on prod). Cheers and have a great weekend! |
👍 great :) I'll try to have those changes up soon, shouldn't be too bad |
Hey @elihart A few days in production already and no crashes so far so I can attest that overriding Cheers and thanks for the support! |
Good to know! Glad that worked. I definitely still want to add those other fixes, so I'll leave this open until then. |
@mradzinski Addressed with #394 One difference is I didn't end up enabling duplicate filtering by default. I instead opted to allow people to also toggle it with a global setting. Would appreciate your thoughts on the interface! |
@elihart Interface looks good to me, pretty straight forward. One question though: would setting a global default mean loosing granularity over individual controllers? I think giving granular control over certain controller (maybe having it not filtering duplicates) while allowing global defaults is the key. If that's the case then I totally love the idea of having defaults (mostly because I have this tendency of forgetting to override the exception swallowing method in the new controllers I write xD) and the way you implemented it. |
@mradzinski thanks for looking! and individual controllers still retain the ability to manually override the global setting, so you should have that granularity. Let me know if you notice a case where you need more control fwiw we used to have duplicate filtering disabled by default, and only enabled it if needed. but after we had too many prod crashes and had to keep doing one off enabling it made sense to just enable it globally (bug crash in debug and log in production) |
@elihart Yeah, that's pretty much what we do, crash while debugging, log while in prod, but on some controllers we do some other stuff aside of logging, like provide default data if there's none and an exception occurs, so being able to still do that while also enabling standard logging by default is pretty much a life saver. Thanks again for the incredible work you've put on Epoxy, TRULY appreciate it. Been using it for months already and proved to be, not only a great way for decoupling and keeping a codebase healthy, but a life saver in other scenarios where complexity was high enough it would've taken ages to handle everything through more standard mediums. |
Thanks for the feedback! Great to hear it is working well for you, and thanks for the appreciation ❤️ If you have feature requests or other feedback please let me know :) |
@elihart Hi, thanks for great work with this library! I have one question regarding |
@TheLester I think an interceptor would be your best bet if you want to replace the duplicate model with something else - https://github.com/airbnb/epoxy/wiki/Epoxy-Controller#interceptors You'll just have to write the logic manually |
Hey @elihart!
I'm currently having some users with crashes due to duplicate models (honestly weird, it happens to just a few users out of 20K, so I'm having a hard time tracing the reason) and would be great if the carousel could filter duplicates and allow swallowing exceptions to avoid those sporadic crashes.
Is there a way to filter duplicates and swallow exceptions on a Carousel? I couldn't seem to find public methods which allowed me to access the underlying EpoxyController :/
Cheers and thanks!
The text was updated successfully, but these errors were encountered: