Skip to content

Conversation

Williamrai
Copy link
Collaborator

What does this do?

  • use view model to load page in the PageFragment
  • introduces state handling in the PageFragment
  • code refactors

Phabricator:
https://phabricator.wikimedia.org/T303945

@Williamrai Williamrai added the WIP Work in progress label Jul 10, 2025
@Williamrai Williamrai added Ready for Review and removed WIP Work in progress labels Jul 15, 2025
Copy link
Collaborator

@cooltey cooltey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just did a quick scan of this PR and it looks pretty good! 👍

One issue I found:

  • When loading an article that has a lead image, the footer does not get loaded correctly, and it shows up after refreshing the page.

handlePageSummary(pageSummary, request)

val watchStatus = watchStatusDeferred.await()
handleWatchStatusAndFetchCategories(watchStatus, request.title)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fetchWatchStatus already contains the categories response, so this function should either pass the categories from the fetchWatchStatus directly, or fetch it only if the categories is empty.

Copy link
Collaborator Author

@Williamrai Williamrai Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, the current logic fetches data based on the applied conditions.

Comment on lines 392 to 398
val Factory: ViewModelProvider.Factory = viewModelFactory {
initializer {
val app = this[APPLICATION_KEY] as WikipediaApp
PageLoadViewModel(app)
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please explain it a bit, and what's the difference if we set a val app = WikipediaApp.instance directly in the view model class?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally, there won’t be a difference since WikipediaApp instance is an object and can be accessed easily everywhere, but ideally, any external dependencies should be injected into the ViewModel even the dataFetcher that i have. I will remove this since this can create confusion.

@Williamrai
Copy link
Collaborator Author

Just did a quick scan of this PR and it looks pretty good! 👍

One issue I found:

  • When loading an article that has a lead image, the footer does not get loaded correctly, and it shows up after refreshing the page.

the read more is loading lazily for me, i can a slight delay though
preview

@Williamrai
Copy link
Collaborator Author

Just did a quick scan of this PR and it looks pretty good! 👍
One issue I found:

  • When loading an article that has a lead image, the footer does not get loaded correctly, and it shows up after refreshing the page.

the read more is loading lazily for me, i can a slight delay though preview

As per discussion, the issue arises rarely and its difficult to reproduce, will monitor this.

@Williamrai Williamrai requested a review from cooltey July 16, 2025 18:31
@Williamrai Williamrai added the HOLD Will review as soon as other more pressing PRs are merged/released. label Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HOLD Will review as soon as other more pressing PRs are merged/released. Ready for Review
Development

Successfully merging this pull request may close these issues.

2 participants