mohd-faraz

_blogs

// blogs / 20260428.md

Dev Log: April 28 Wrap-up

2026-04-28
#React#Gemini-API#Backend-Fixes#Form-Logic#Vite

Overview

Today was a bit of a split personality day. I spent the first half scaffolding out a new portal project and playing with some AI integrations, while the second half was spent deep in the weeds of form logic and ticket processing for our internal tools.

What I Worked On

Starting the Portal & AI Integration

I kicked things off by initializing a new React project using Vite. It's always satisfying to start with a clean slate—minimal boilerplate, fast HMR, and none of the legacy baggage. Once I had the basic structure down, I jumped straight into the fun stuff: integrating the Gemini API.

I spent some time building a robust wrapper for the generative calls. I didn't just want a simple fetch; I needed it to be resilient. I implemented a recursive retry mechanism with exponential backoff because, let’s be honest, API calls fail at the worst times. I also added support for system instructions and Google Search tools to keep the responses grounded. It's still early stages, but seeing the chat interface actually start talking back was a great win for the morning.

Batch Processing for Tickets

On the backend side, I had to fix a limitation in our helpdesk logic. We were receiving webhooks that sometimes contained multiple IDs in a single field, but our controller was only expecting one.

I refactored the processing logic to split those comma-separated strings and loop through each ID individually. It sounds straightforward, but I had to make sure that if one ID in the batch failed or was missing, it didn't tank the whole request. Now it logs the status for each segment and moves on. It’s much more defensive and handles the messy data users actually send us.

Cleaning up the Dynamic Form Builder

I ran into an issue where certain "master" settings were showing up in views where they didn't belong, specifically when the app is being used inside an iframe.

I added a new property to our form configuration called forceTrueInIframe. The idea is to automatically lock down specific toggles if the system detects it's being embedded. If it finds the bridge service is available, it forces the value to true and disables the field; otherwise, it just hides it entirely to keep the UI clean. It’s a small tweak, but it prevents a lot of configuration errors from happening downstream.

Wrapping Up

It feels good to have the foundation of the new portal laid out. Tomorrow, I’ll probably dive deeper into the AI response parsing—handling the raw text is one thing, but making it look good in a UI is a whole different beast. Catch you then.