I'm a front end developer, I work in a Saas company.
Various apps/projects, agile approach, Jira tickets, git, teams. That is the gist of it.
I have one problem. A technical one, maybe behavioural, maybe moral:
when I get assigned a new story I struggle to stay in scope.
I'll go with an example:
An app with not more than 3 dozens React components, a fairly complex Redux store and a few API calls. It's not a massive app.
My story is to add, conditionally, a new level of nesting in a list: now some items have subitems, need to change the UI, probably mess a bit with the state/store.
The code app in my opinion is hard to read, eg. every react component is HOC'ed with a redux wrapper. Or state has too much derived data in it.
Or the file structure is wrong, components have long names, they are organised by type, not by feature and there's a lot of them now.
Or there is no strategy in regards of code formatting, I want no semi, my colleague does. Etc.
I'm not blaming someone else, I was part of the team that made the app like that, months and months and months ago, at the beginning of our React journey.
During this time I obviously improved so that code, that I feel responsible for, I just cannot accept it. Actually it became so complex that I'm struggling to reason with it!
Assume I'm the only one working on the front end of this app at this moment.
I'm about to go over time because I started to send PR with refactors: prettier on pre-commit to keep it consistent on git, organize the files in the area around my story by feature, remove nested redux HOCs and just pass props 1, max 2 level down and other small refactors. I'm also coding the actual story I was originally assigned but this is obviously taking more time.
I could have proposed the changes, worked at my story and maybe later, in the future, implement those changes following the process.
Making this 'big' changes, not strictly related to the assigned story is not right.
It may ruin other people plans. It's just not really good. But I kinda forced my stakeholders into taking those changes.
Although now the code is already in a much better state and I can finally work with it effectively.
What should I've done?