If you know you will be stuck working on something for a while, spend a little extra time on each progression, like solving edge cases, performance issues, compatibility, and writing automatic tests for regression. That way you can spend more time on actually adding value, rather then catching fires and debugging.
And if you're new to a team or a company, do not underestimate the value of confirming documentation and test cases(if they exist!) and improving upon them if it's possible. This helps in multiple ways: you gain a reasonable understanding of the codebase through reading and testing; you are immediately contributing value to the team by improving upon the process and making it easier for you to onboard new people when the time comes; you gain the confidence of your team by showing interest in details that may have been overlooked for significant periods of time, allowing cruft to build up and plenty more.