This change sets the default value of the competition drop-down in the match navigation component based on which competition is set in the database to be is_current. This default is set when the component loads and then immediately fetches the matches for that competition to be displayed in the table.
Details
I chained the two fetches (competition and matches) to ensure synch behavior. Javascript fetches are async so we would possibly get into the situation (at competition where cellular connections are slower) where the match fetch comes before the competition fetch. By chaining we can avoid this possible bug.
Testing
I tested on my local to make sure default is set correctly and user can still choose other competitions with proper table refresh.
Next Steps
I still want to clean up the casing of the variable names but the main next step is to make the rows clickable so the match data component loads. I will play with making the whole row clickable which may be easier on smaller mobile devices (rather than a button) and we can see how it works.
Summary
This change sets the default value of the competition drop-down in the match navigation component based on which competition is set in the database to be is_current. This default is set when the component loads and then immediately fetches the matches for that competition to be displayed in the table.
Details
I chained the two fetches (competition and matches) to ensure synch behavior. Javascript fetches are async so we would possibly get into the situation (at competition where cellular connections are slower) where the match fetch comes before the competition fetch. By chaining we can avoid this possible bug.
Testing
I tested on my local to make sure default is set correctly and user can still choose other competitions with proper table refresh.
Next Steps
I still want to clean up the casing of the variable names but the main next step is to make the rows clickable so the match data component loads. I will play with making the whole row clickable which may be easier on smaller mobile devices (rather than a button) and we can see how it works.