How a Clever URL-Based Modal Saved My Day at Work

Shubham JainShubham Jain
3 min read

A Problem at Work

Today was one of those days at work when a seemingly small issue quickly escalated into a major headache. I was working on a project where the app was running a WebView for a particular page. The goal was simple: redirect users back to the app from the WebView to a specific screen. But, of course, there was a catch.

The screen in question was a bottom sheet, and it wasn’t expecting the additional data I needed to pass along with the redirection. Normally, this wouldn't be a big deal, but there was one major complication: to modify the bottom sheet to accept this data, we would need to push out an app update. And as any developer knows, app releases are a process. But we needed this feature rolled out today.

The Solution: URL-Based Modals

As I was wracking my brain trying to figure out a solution, I suddenly remembered a technique I had previously written about: URL-Based Modals with Query Parameters. This method is incredibly flexible and allows you to control modals through URL parameters.

The lightbulb moment came when I realized that our website had the same bottom sheet component implemented as a modal. And even better, it was already using the second method I had discussed in my article, where modals are controlled via query parameters in the URL.

A Quick Fix That Worked Like Magic

I quickly implemented this solution by calling the modal component on the web page and passing the necessary data via query parameters. In a matter of minutes, everything was working perfectly. The backend could simply adjust the redirection URL to include the additional query parameters needed to open the bottom sheet with the correct data.

This approach not only saved the day but also reinforced the importance of backend-driven solutions. By allowing the backend to control aspects like which modals to display and with what data, you can avoid unnecessary app updates and make your frontend far more flexible.


Why Backend-Driven Solutions Are a Game Changer

This experience further solidified my belief in the power of backend-driven solutions. When you design your application to be flexible and controlled by the backend, you give yourself the ability to adapt quickly to new requirements without the need for frequent app releases.

Read More About It

If you're interested in learning more about how to drive your application through the backend, check out some of my previous articles:

And stay tuned for more articles where I'll dive deeper into how to make your app truly backend-driven. Trust me, it's a game-changer.

10
Subscribe to my newsletter

Read articles from Shubham Jain directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shubham Jain
Shubham Jain

I work as an SDE-1 in frontend role at a healthcare startup. I am always curious to learn new technologies and share my learnings. I love development and love to code.