I was watching an anime called The Heavy Knight Knows How to Game the System while working on my dashboard, which feels appropriate because apparently tonight's engineering strategy was also going to be gaming the system.
Not in the illegal way.
In the "why the fuck is this component making an API request when nobody even clicked the thing?" way.
The kind of optimization where you stare at your network tab for five minutes and slowly realize your own application has been walking into the kitchen every ten minutes just to check whether anyone wanted a sandwich.
So naturally, I fixed it.
And then I kept fixing shit.
This started as a Series attachment improvement and somehow ended with me auditing API fetch behavior, collapsing dashboard sections, fixing some sneaky state transitions, bumping the version, and generally teaching my portfolio dashboard the ancient engineering technique known as don't do shit unless somebody needs it.
The Series Problem That Wasn't Actually a Problem
The first thing I wanted to clean up was attaching blog posts to Series.
The backend already knew how Series worked. The editor already supported seriesId and seriesOrder. The Series management pages already existed.
The actual problem was the editor UX.
It worked.
It just worked in the same way that a government website technically works.
There was a selector. You could select a Series. You could clear it. You could attach a post.
But if I was going to have a proper Series system, I wanted the editor to actually feel like it belonged to the rest of the application.
So the selector became a drawer.
Searchable Series.
Published and draft filters.
Metadata.
Preview.
Clear.
Inline Series creation.
And, most importantly, automatic chapter ordering.
Because apparently I decided that asking myself what chapter number something should be was too much manual labor.
The Fun Part Was Preserving Existing Order
This is where the innocent little UI feature started growing teeth.
Suppose a blog post originally belongs to Series A at position 11.
You switch it to Series B.
Cool.
It should get the next available position in Series B.
Then you switch it back to Series A.
Should it become chapter 12?
No.
It was originally chapter 11.
So it should return to 11.
Unless you explicitly cleared the Series first.
Then you are basically saying:
"No, I'm breaking up with this Series."
And if you later attach it again, congratulations, you're a new relationship. Find the next available chapter.
That meant the state machine needed to understand the difference between:
A/11 → B → Aand:
A/11 → Clear → AThose look almost identical to a normal human.
They are absolutely not identical to application state.
The first one restores the original relationship.
The second one creates a new relationship.
That tiny distinction is exactly the sort of shit that becomes a bug report three weeks later because somebody attaches a blog post to the wrong chapter and suddenly everyone is staring at seriesOrder like it personally betrayed them.
So we handled it explicitly.
The Series Picker Also Learns to Count
When attaching a post to a new Series, the editor doesn't just guess an order.
It checks the target Series' chapters and calculates the next position.
Which means:
Current Series: A
Current Order: 11
Select Series B
Fetch B's chapters
Find highest order
Add 1
Attach → B/9No hardcoded assumptions.
No "probably 1".
No "we'll sort that out later."
That little bit of paranoia is worth it.
Because "later" is where technical debt goes to reproduce.
Then the Dashboard Started Calling the API for No Fucking Reason
This is where things got more interesting.
While working through the dashboard, I noticed the Social Publishing sections were fetching data immediately.
The sections were there.
The data was there.
Everything was technically fine.
Except the user hadn't opened the fucking sections.
Why are we making the API do cardio?
So I changed the Social Publishing Status section to start collapsed.
Same with Recent Activity.
The component can exist without immediately demanding that the backend hand over its entire life story.
Collapsed Means Actually Collapsed
This sounds obvious.
It wasn't just:
Hide the UIwhile secretly doing:
GET /social/status
GET /social/activityin the background anyway.
The query itself gets disabled.
Open the section?
Now we fetch.
Close it?
The data remains cached.
Open it again?
TanStack Query can reuse the cache instead of acting like we just met for the first time.
This was one of those changes where the implementation is almost boring.
Which is good.
Boring code is underrated.
Then I Found the Top Navigation Doing It Too
And then I looked at the integration status icon in the top navigation.
Oh.
Oh no.
The navbar was also checking integration status.
On page load.
Every time the top navigation mounted.
It was checking Google Drive.
Discord.
Facebook.
LinkedIn.
All so it could calculate whether the little badge should say !, 2, or nothing.
The dashboard was basically saying:
"Hello backend, I have a very important question."
Backend:
"What?"
Dashboard:
"Nobody clicked the integrations menu."
Backend:
"..."
Dashboard:
"Anyway, see you on the next page."
My Portfolio Was Apparently Running a Small Call Center
The queries themselves had a ten-minute staleTime, so this wasn't some catastrophic API abuse situation.
But it was still unnecessary.
And because this is my own backend, deployed on my own infrastructure, I had the increasingly uncomfortable realization that I was using my own free Railway bandwidth to ask questions nobody had asked.
Excellent.
I've successfully become my own worst SaaS customer.
There was also the possibility of hitting rate limits on the external integrations eventually, which would be an especially stupid way to discover that my portfolio website has more enthusiasm than restraint.
So I audited the whole fetch path.
The Badge Was the Catch
The obvious solution would have been:
Only fetch when the menu is open.
But there was a catch.
The badge itself depended on the API responses.
If we stopped fetching, we wouldn't know whether there were expired integrations.
And if we treated undefined as zero, the UI would basically lie.
That would turn:
Data unknowninto:
Everything is fine.Which is not exactly a great status indicator.
So the safer solution was:
Before first open:
No data
→ no badge
→ neutral "Integrations" label
First open:
Fetch
After first fetch:
Normal badge behaviorThe important part is that the queries don't toggle off again when the menu closes.
Once the user has opened the menu, the queries stay enabled and TanStack Query handles the cache and stale lifecycle normally.
Because apparently the correct engineering solution was to teach the dashboard the concept of consent before surveillance.
Gaming TanStack Query Instead of Fighting It
This is probably where the anime started influencing the implementation.
The Heavy Knight knows how to game the system.
So I decided my dashboard should also game the system.
Not by abusing anything.
Just by understanding the rules.
TanStack Query already gives us:
caching
stale times
shared query keys
invalidation
background refetching
So instead of inventing some giant integration state manager, the solution was basically:
Don't enable the query until somebody gives a shit.
And because the query keys are shared, another component can populate the cache first.
So if Blog Posts already fetched:
["social", "status"]the navigation doesn't need to reinvent the request.
It just gets the cached result.
That's the kind of "gaming the system" I can get behind.
The Weird Thing About Small Features
The funny thing about this whole session is that none of these changes individually feels particularly huge.
The Series picker is a UX improvement.
The dashboard sections collapse.
The integration menu becomes lazy.
The footer gets cleaned up.
The version goes from v2.2.0 to v2.2.1.
Nothing exploded.
Nobody had to rewrite the application.
There was no heroic migration where I deleted 40,000 lines of code while orchestral music played in the background.
It was just a bunch of small annoyances getting removed.
And honestly, those are some of my favorite engineering sessions.
The ones where you look at something and go:
"Why the fuck does it do that?"
Then you fix it.
The Footer Also Got Some Attention Because Apparently I Have Standards
The footer got cleaned up too.
The main content is centered.
The copyright positioning is handled separately.
And the displayed dashboard version is now:
v2.2.1
Which is hilarious because changing a version number is probably the least interesting thing in this entire session.
But somehow version numbers are always the thing that make a release feel real.
You can spend hours fixing query lifecycles and state machines.
Then you change:
v2.2.0to:
v2.2.1and suddenly your brain goes:
"Holy shit. Software."
The Audit Was Probably More Important Than the Code
The actual implementation was relatively straightforward.
The audit was where most of the useful information came from.
I wanted to know:
Which components already fetch these queries?
Which query keys are shared?
What happens if another component already populated the cache?
Does disabling the query break the badge?
What happens after reconnect?
What happens when the menu opens again?
What happens when an integration is expired?
Are we accidentally refetching every time?
Does the hook support
enabled?Can the change remain backward-compatible?
Because the dangerous part isn't making something lazy.
The dangerous part is making something lazy and accidentally turning:
connectedinto:
¯\_(ツ)_/¯or breaking some other page because three different components secretly depend on the same query key.
So the implementation stayed deliberately boring.
Three files for the final top-nav change.
Optional enabled = true parameters.
Existing cache.
Existing invalidation.
Existing stale time.
No new abstraction.
No backend changes.
No giant refactor.
Just less bullshit.
What I Actually Built Tonight
By the end of the session, the dashboard had:
Series
A searchable drawer-based Series picker with:
published/draft filtering
previews
inline Series creation
automatic chapter ordering
original-order restoration
explicit-clear handling
Social Dashboard
Collapsible publishing status and activity sections that don't fetch their data until they're actually opened.
Integrations
Integration status queries that don't run merely because the navbar exists.
Cache Behavior
Shared TanStack Query caches that can be reused across pages instead of making duplicate requests.
Dashboard
A cleaner footer and version bump to v2.2.1.
Documentation
Audits and implementation planning for the Series work.
Code Review
A bunch of small state transitions that could have become annoying bugs later were checked before they got the chance.
Meanwhile, the Anime Is Still Playing

And through all of this, I'm watching an anime about a heavy knight who apparently figured out how to exploit game knowledge to become absurdly effective.
Which is probably why this entire session feels strangely appropriate.
The character is looking for mechanics.
I'm looking for unnecessary API calls.
He's reading the system.
I'm reading query keys.
He's exploiting the rules.
I'm exploiting staleTime.
He's trying to survive.
I'm trying to survive my own Railway bill.
Different circumstances.
Same energy.
And honestly, I think that's the real After Hours developer experience.
You put on some random anime, open your editor, tell yourself you're only going to fix one small thing, and three hours later you're auditing cache invalidation because you discovered your navbar has been interrogating your backend every time someone looks at the homepage.
Then you bump the version.
Run TypeScript.
Zero errors.
Sit back.
The penguinz0 voice in your head goes:
"Yeah. That's pretty fucking stupid."
And you know what?
He's right.
So we fixed it.
No rebuild.
No rewrite.
No dramatic resurrection of the entire codebase.
Just a slightly smarter dashboard, a slightly less abused API, and one more evening where the anime somehow became part of the architecture review.
v2.2.1.
The system has been gamed.
The knight would approve.