DEV Community

Cover image for Skill Tree Update 4/11/2022
tieje
tieje

Posted on

Skill Tree Update 4/11/2022

app so far

Contents

Introduction

"Your greatest enemy is yourself from 10 hours ago."
-- Factorio players

  One of the goals of this week was to add statefulness to the skill tree app. Fortunately, pan and zoom works perfectly fine out of the box. Event listeners for keyboard shortcuts were actually pretty easy to add. One portion that I struggled with was experimenting with PUT, PATCH, and POST methods using RTK Query on the frontend. Despite understanding how it all works, there's that nagging feeling in the back my head that's like, there's no way this is going to work. But it did work. I have CRUD functionality now!

CRUD functionality

Update

Backend

Two Steps Forward One Step Back

  The big mistake I made was using multiple sources of state. There should only be one source of truth in state management. Ultimately, this mistake led to not being able to add a new hexagon on the fly without reloading the window. I could not invalidate the query because I loaded my state from a slice and not from a useQuery hook. I needed to implement a useQuery hook from RTK Query so that I can invalidate the query and it can grab data from the API. I was using RTK Query incorrectly.

Work and Life Balance with Weekend Wednesdays

Weekend Wednesdays

Weekend Wednesday is making Wednesday a day-off and making Saturday a work-day. Knowledge workers may want to adopt this schedule because our performance diminishes significantly as days go on without a day of rest. This week marks my first weekend Wednesday trial and I already feel significantly more productive and happier than on the old Monday through Friday schedule.

Conclusion

  Last week, I learned a lot about working with queries in general. CRUD functionality for hexagons is now complete. This week I'll be moving on to CRUD functionality for paths. Now that I understand queries, I feel like frontend development should be smooth sailing from here on out.

Top comments (0)