Skip to content
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

BUG - DashboardView events Aren't Loading on the First Load #210

Closed
Tracked by #260
mikaelacaron opened this issue Oct 24, 2023 · 13 comments · Fixed by #273
Closed
Tracked by #260

BUG - DashboardView events Aren't Loading on the First Load #210

mikaelacaron opened this issue Oct 24, 2023 · 13 comments · Fixed by #273
Assignees
Labels
bug Something isn't working hacktoberfest Any issue that can contribute to hacktoberfest help wanted Extra attention is needed

Comments

@mikaelacaron
Copy link
Owner

Describe the bug

  • The MaintenanceEvents on the DashboardView aren't loading, when the app is first loaded. Instead it's showing the empty screen that says "Add your first maintenance event"

To Reproduce

Steps to reproduce the behavior:

  1. Add at least one vehicle and at least one maintenance event
  2. Make sure the first tab that is going to open is the Dashboard (it saves the last tab when the app was closed)
  3. Run the app and wait for the app to load and show events
  4. The events never load, and it only shows the "empty view" that says Add your first maintenance

Expected behavior

  • The Dashboard tab loads the data even when it's the first tab to be open, you do NOT need to tap to a different tab, and tap back to see data

Screenshots

  • N/A

Device Info (please complete the following information):

  • Device: iPhone 15 Pro Simulator
  • OS: iOS 17.0
  • App Version: v1.0 (1)

Additional Context

  • Add any other context about the problem here.
@mikaelacaron mikaelacaron added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers hacktoberfest Any issue that can contribute to hacktoberfest labels Oct 24, 2023
@anupdsouza
Copy link
Contributor

@mikaelacaron , can I look into this while I wait for my existing PR to be merged ?

@mikaelacaron
Copy link
Owner Author

Yes because your other PR is CI related!
If it was iOS code related, I'd prefer to have you wait until your PR is merged incase there are changes you need to make

@anupdsouza anupdsouza removed their assignment Oct 25, 2023
@hanhqvu
Copy link
Contributor

hanhqvu commented Oct 26, 2023

@mikaelacaron Since anup unassigned themselves, could I take over this?

@hanhqvu
Copy link
Contributor

hanhqvu commented Oct 30, 2023

@mikaelacaron This bug seems complicated that I thought. I checked and it seems the DashboardViewModel deinit which is why events are no longer stored in memory. I tried replacing with @State events and it seems to be okay. I will need some more time to investigate if okay with you. I will close the PR for now.

@hanhqvu
Copy link
Contributor

hanhqvu commented Oct 30, 2023

More info on when the view model get deinit:

  • 1st load or from background to foreground: .task get called then deinit get called => No events
  • Switch from other tabs: .task get called then deinit doesn't get called => Events are shown

@mikaelacaron mikaelacaron removed the good first issue Good for newcomers label Oct 30, 2023
@mikaelacaron
Copy link
Owner Author

I tried replacing with @State events and it seems to be okay

This shouldn't need to happen, because the DashboardViewModel is @Observable

But hmm yeah this seems like it might be tricky

@hanhqvu
Copy link
Contributor

hanhqvu commented Oct 31, 2023

Sorry for being unclear, I mean change events to @State within the view itself.
This is kinda tricky but I'm thinking it has something to do with scenephase, since the view model get deinit only scenephase changes

@hanhqvu
Copy link
Contributor

hanhqvu commented Oct 31, 2023

Probably not gonna be done in time for hacktoberfest but if it's okay with you, I'll keep looking into this & keep you updated.

@mikaelacaron
Copy link
Owner Author

Probably not gonna be done in time for hacktoberfest but if it's okay with you, I'll keep looking into this & keep you updated.

That's fine, I'll look back into this afterwards too before I publish it to the App Store, but I believe this was working at first, so you may be able to go back in the commits and look for a time when it was working

@windrunner21
Copy link
Contributor

Hey @mikaelacaron! Would be happy to help you with this issue. Are there any deadlines?

@mikaelacaron
Copy link
Owner Author

If you could finish it by Dec 1 that would be great! Thanks!

@windrunner21
Copy link
Contributor

Hi again @mikaelacaron. I have opened a pull request. Waiting for the review, hope it helps! Good luck and thanks again!

@mikaelacaron
Copy link
Owner Author

Thanks so much!! I'll review it soon! I love how small of a fix it was

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hacktoberfest Any issue that can contribute to hacktoberfest help wanted Extra attention is needed
Projects
4 participants