DEV Community

Cover image for eSlayers part 6 - fetching matches... finally
Rembrandt Reyes (He/Him)
Rembrandt Reyes (He/Him)

Posted on

2 2

eSlayers part 6 - fetching matches... finally

Finally made it to fetching some sort of match history. There is definitely a lot of refactoring that needs to be done, but for now, I am pretty content with what I got.

Things I completed today

  • Modified server.ts to add an additional proxy route.
  • Added a Match.tsx component which returns game_date and participants.
  • Added a Participant.tsx component which will return a summoner's name from their puuid.
  • Modified Summoner.tsx to test newly fetched data.
  • Modify fetchLeague.ts URL to the updated proxy API.
  • Modify fetchSummoner.ts URL to the updated proxy API and add in a new function to fetch summoner based on use puuid.
  • Add a new fetch to get data of a single TFT match.
  • Add a new fetch to get an array of matches.

Pain points

There were a lot of issues at first because I was trying to do some data manipulation on stuff that was not fully fetched yet. I thought I was doing things right with useSWR conditional fetching, but I just fooled myself, sorta. Lot's of console.logs and chrome debugger to see what was happening and where my code was breaking. I landed on a solution that seems to work 100% of the time now. I think once I start breaking things down even further the pieces will start to come together and things will play nicer with each other.

For the future

At some point, I am going to want to save this data to some sort of state manager. Deciding between redux or React.Context. I am also wondering if this app will be possible with just useState. I don't have a clear picture yet since I can do everything with fetching. Once I get to a "finalized" state of data that I am going to display I will decide on a state manager.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Instrument, monitor, fix: a hands-on debugging session

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️