mohd-faraz

_blogs

// blogs / 20260627.md

Dev Log: June 27 Wrap-up

2026-06-27
#Angular#RxJS#Refactoring#CleanCode

Overview

Today was mostly about alignment and making our modules a bit more flexible. I spent a good chunk of time untangling some data mapping issues and ensuring that our distributor components aren't hardcoded to a single resource type.

What I Worked On

Context-Aware Routing

One thing that was bugging me was how our deal management component was tied directly to a single 'orders' resource. This worked fine for standard flows, but it broke as soon as I tried to use it for distributors, who have their own distinct data sets.

I refactored the routing logic to pass the resource type through the route data. Now, the component is context-aware—it just asks the route what it should be looking at, which makes it much more reusable. It’s a simple change, but it saves me from having to maintain two nearly identical components.

// Fetching the resource dynamically from the active route
this.currentData.resourceDef = {
  resource: this.route.snapshot.data['target_resource'],
  application: 'crm'
};

The Mapping 'Derp'

I hit a classic 'derp' moment today where the frontend was looking for a field called contactPerson while the backend decorator and the database were actually using name. It’s one of those silent failures where the form just stays empty and you spend ten minutes wondering why the data isn't loading before realizing the keys don't match.

I went through the decorators and the JSON configuration files to standardize this. While I was at it, I cleaned up the field ordering in the UI and toggled some 'disabled' states on fields that shouldn't be edited manually.

Optimizing the Data Flow

Following up on some performance concerns from yesterday, I refined the way we handle in-flight requests. I noticed that if a user navigated quickly or if multiple widgets loaded at once, we were hammering the API with identical requests.

I implemented a basic tracking map in our data service. If a request for a specific resource is already in progress, any new subscribers just hop onto that existing observable instead of starting a new one.

It’s satisfying to see the network tab go from a waterfall of redundant calls to a clean, single set of requests. RxJS shareReplay is doing a lot of the heavy lifting here.

Wrapping Up

Everything feels a lot more stable now that the distributor flow is actually pointing at the right data sources. Tomorrow, I want to dive a bit deeper into the invoice triggers to make sure the automated notifications are firing correctly when a payment is finalized. Catch you then.