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: Data from Custom hook does not re-render when data loads #52

Open
1 task
tyler-morales opened this issue Oct 23, 2021 · 9 comments
Open
1 task
Assignees
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest hacktoberfest2021 help wanted Extra attention is needed

Comments

@tyler-morales
Copy link
Owner

tyler-morales commented Oct 23, 2021

In the Game Activity tile, the expected behavior inside the "GAME ACTIVITY STATS" should read out the current date and the number of games played on that date.

Currently, when I call the custom hook to fetch the number of games, the hook only returns 0 even when there exist games. The number of games only appears if a user clicks the day in the heatmap. The number of games should appear on page load for the current date.

The file that needs fixing is ChartHeatmap.js and you might want to look at useLoadSpecficRecords.js

Acceptance Criteria:

  • The current day should read out the data (whatever the current day is) and the number of games played during that day.

Below: This is incorrect. The number of games played should be 2. 2 only appears once October 22 is clicked in the heatmap.

Screen Shot 2021-10-22 at 10 46 19 PM

Let me know if you have any issues or questions. You'll need an aws-exports file if you work on this issue. That can be found in the other current issue in this repo.

@tyler-morales tyler-morales added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers hacktoberfest hacktoberfest2021 labels Oct 23, 2021
@inovux
Copy link

inovux commented Oct 23, 2021

Heya @tyler-morales Can I look into this :)?

@sashank002
Copy link

hey @tyler-morales can i try this ?

@YasarArafathAli
Copy link

#53 Hey @tyler-morales... Can I have a look into this??

@tyler-morales
Copy link
Owner Author

@inovux yes, you can work on this

@inovux
Copy link

inovux commented Oct 23, 2021

@tyler-morales awesome thanks! I tryed running the project, locally but it seems like it wont let me start it. Is there anything that I have to set up before running start?

@tyler-morales
Copy link
Owner Author

Yes, check out my comment with an aws-exports file here
#29

Let me know if you have any further issues

@inovux
Copy link

inovux commented Oct 23, 2021

@tyler-morales awesome thanks lemme try!

@inovux
Copy link

inovux commented Oct 24, 2021

@tyler-morales I dont think this will be fixable with the current infrastructure of the app. It is re-rendering a lot in unexpected ways.

I would suggest having a container or global store to hold the state of the app. The main problem now is that the hooks are using asynchronous functions and the data of the asynchronous functions is checked again with other asynchronous hooks inside the component. This probably needs some changes e.g. passing properties to the Grid components instead and managing the state in the parent of the Grid component.

Let me know if you think its a good idea to rework the way the state is managed right now. If you think there is a solution to this bug with the current infrastructure let me know what you have in mind :)

@tyler-morales
Copy link
Owner Author

Thanks for your help @inovux. I appreciate you going through my code and taking the time to look for a possible solution.

This is the largest codebase I have ever worked on and the first time I really dive into React. Because of this, I am totally open to hearing about new and better ways to organize the app's state.

I spend too many hours trying to get my custom hooks to work together all the while being asynchrous, so if you want to update any parts of this, I am happy to hear you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest hacktoberfest2021 help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants