Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

[Fix] ChartView category change is not working correctly #58

Closed
ChoiysApple opened this issue Dec 5, 2023 · 1 comment
Closed

[Fix] ChartView category change is not working correctly #58

ChoiysApple opened this issue Dec 5, 2023 · 1 comment
Assignees
Labels
🐛 bug Something isn't working
Milestone

Comments

@ChoiysApple
Copy link
Owner

Describe

When new category is selected from UIMenu, Chart Table View should be reloaded immediately. But It doesn't reload until manual refresh

To Reproduce

  1. Go to Chart Tab
  2. Select different category from UIMenu

Expected behavior

Chart Table should reload immediately when UIMenu selected

Screenshots

this was image

Device: iPhone 12 mini
OS: iOS 16.1

@ChoiysApple ChoiysApple added the 🐛 bug Something isn't working label Dec 5, 2023
@ChoiysApple ChoiysApple added this to the 0.1.1 milestone Dec 5, 2023
@ChoiysApple ChoiysApple self-assigned this Dec 5, 2023
ChoiysApple added a commit that referenced this issue Dec 12, 2023
### Describe
- In Charts View, list content seems like not changing when category is
changed but It's reloading
- New list was appended to existing list but it should replace existing
list
- Because `currentPage` property is added by 1 whenever category
changed, new list is considered as next list

### Changes Made
Remove currentPage adding code from `requestData(category:
MovieListCategory)`
```swift
    func requestData(category: MovieListCategory) {
        
        if currentCategory != category { currentPage = 1 }
        currentCategory = category
        fetchData(category: category)
        // current page += 1
    }

```


### Issues Resolved
- #58 
<!-- 
If this pull request addresses or closes any related issues, mention
them here. Use the GitHub issue linking format
(e.g., "Feature #123"). 
-->
ChoiysApple added a commit that referenced this issue Dec 12, 2023
### Describe
- In Charts View, list content seems like not changing when category is
changed but It's reloading
- New list was appended to existing list but it should replace existing
list
- Because `currentPage` property is added by 1 whenever category
changed, new list is considered as next list

### Changes Made
Remove currentPage adding code from `requestData(category:
MovieListCategory)`
```swift
    func requestData(category: MovieListCategory) {
        
        if currentCategory != category { currentPage = 1 }
        currentCategory = category
        fetchData(category: category)
        // current page += 1
    }

```


### Issues Resolved
- #58 
<!-- 
If this pull request addresses or closes any related issues, mention
them here. Use the GitHub issue linking format
(e.g., "Feature #123"). 
-->
@ChoiysApple
Copy link
Owner Author

Cause

List content is reloading but list from API if appended to existing list but it should replace existing list

In ChartViewModel, requesting movie list works different with currentPage

  • currentPage == 1 - replace existing list with new list
  • currentPage > 1 - append new list to existing list
    But requestData(category: MovieListCategory), which is method used when category changed, is adding currentPage incorrectly.

Solution

removed invalid currentPage adding code

    func requestData(category: MovieListCategory) {
        
        if currentCategory != category { currentPage = 1 }
        currentCategory = category
        fetchData(category: category)
        // current page += 1
    }

ChoiysApple added a commit that referenced this issue Jan 3, 2024
End of milestone 0.1.1

### Issue Resolved
- #57 
- #58
- #63 
- #65
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛 bug Something isn't working
Projects
No open projects
Status: Deployed
Development

No branches or pull requests

1 participant