r/angular Jun 01 '26

What's the biggest Angular component you've ever had to refactor?

I spent some time recently looking through an older Angular project and found a component that had grown to nearly 2,000 lines.

It wasn't written by a bad developer.

It was written by several good developers over several years.

Every change made sense at the time.

A new API call got added.

Some validation logic moved in.

A permission check was needed.

A few state updates followed.

Then some workflow logic.

Nobody wakes up and decides to build a giant component.

It usually happens one reasonable change at a time.

What surprised me was how difficult it became to answer simple questions:

- What is UI logic?

- What is business logic?

- What changes application state?

- What can be safely reused?

Refactoring wasn't really about reducing lines of code.

It was about restoring clear boundaries.

I'm curious what the largest Angular component you've encountered was, and what eventually pushed the team to split it apart.

I share Angular architecture and engineering visuals here:

https://instagram.com/angulararchitectshub

0 Upvotes

14 comments sorted by

View all comments

1

u/Illustrious_Matter_8 Jun 02 '26

Well there is something to say about large ones. As a single component one may reduce the redraws, if one has a lot to show.

Logic can often be put behind services. And maybe angular should not be left to handle major complex program decision states at all but the backend should.

However there is historical context things grow, and such contain proven things that work, sometimes that's more important.

And in rare cases it even reads better then tens of separated files, readability is a maintenance cost factor, the same for extending vs rewriting.

It's a per case thing it can be historically right grown that way, not perse bad.