I follow a similar pattern to others.
I write a lot of historical fiction (usually with some fantasy elements too) so I do a lot of research. I'm a history graduate so know a little about ancient Roman/Greek culture, a smattering of early modern European, Victorian. The combination makes for someone who can easily disappear down the warren of research and who is particularly picky about getting details right! If a particular area of the UK didn't have gas Street lighting until the year after my story is set, I won't sneak it forward to suit my fiction needs. Unnecessarily pedantic of me, I know.
But even I admit we can't know everything, some details have to be invented.
I'm writing a serial for a magazine at the moment set in the music hall of the early twentieth century, which has been fascinating to research. I read around the subject first and some of that had informed a plot thread.
But my WIP is set during the winter of 1973/74 during the industrial action that caused the three day week so I've also been learning a lot about trade unions, 1970s politics, period music, TV, fashion, social attitudes, race riots...
As others have said, though, your research must be worn lightly. Years ago I read a commercially published medieval murder mystery where just in the opening chapter, there were lengthy explantations of parts of a castle, a gearing system, local bureaucracy. The in depth explanations we're unnecessary (I don't need to know how the gearing worked unless it relates to the plot) and slowed the action. The author was an historian by trade ... A lesson for me!