cardoso / ReduxMovieDB

🎥 See the upcoming movies! ReSwift + RxSwift 💖 Hacktoberfest 🎃
MIT License
203 stars 35 forks source link

Fix excessive TMDB requests sent when viewing movie details #35

Closed nivanchikov closed 4 years ago

nivanchikov commented 4 years ago

Issue: The movies list gets re-fetched each time the user opens or exits the movie details screen on a device with a compact-width trait (e.g. iPhoneX or iPhone XS Max in portrait orientation). See the attached gif with a dump of requests being sent when I was opening various movie details

Why this happens:

Proposed solution: This pull request adds a couple of new actions to differentiate when the movie details screen is always visible in a split view controller. If the details screen is currently the only visible one, e.g. in a compact-width device orientation, the searchBar.rx.text events are additionally filtered to disallow updating the search state when the search screen is not visible

Screen Recording 2019-10-07 at 3 19 13 PM

codecov-io commented 4 years ago

Codecov Report

Merging #35 into master will increase coverage by 0.34%. The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #35      +/-   ##
=========================================
+ Coverage   69.85%   70.2%   +0.34%     
=========================================
  Files          13      13              
  Lines         428     443      +15     
=========================================
+ Hits          299     311      +12     
- Misses        129     132       +3
Impacted Files Coverage Δ
ReduxMovieDB/State/MainState.swift 100% <100%> (ø) :arrow_up:
...xMovieDB/Controllers/MovieListViewController.swift 89.58% <100%> (ø) :arrow_up:
ReduxMovieDB/Controllers/SplitViewController.swift 48% <25%> (-4.39%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e812687...3d69174. Read the comment docs.

cardoso commented 4 years ago

Hi @nivanchikov 👋 thanks for your contribution! I'll review as soon as possible.