It is arguable whether you underbid, but your partner definitely did.
when you open 1H, your partner knows that you have at least 26 HCP and eight hearts between you. This is enough that they should drive to game and not give you the option to pass at all, they should make forcing bids until you reach game. If anything, they should consider the possibility of a slam in case you have more than a minimum.
It doesn't matter how long the auction goes on for, until you reach game your partner should not make a bid that you can pass.
The 3H call from your partner is, in basic standard American, an invitational call, which indicates that partner needs something extra from you to make game. You do have a little bit extra in the form of the sixth heart, but you are dead minimum in HCP and while you have a void, it is in partner's suit. This will help you establish that suit by ruffing, but you may find yourself lacking entries to partner's hand once you do. It is arguable whether you should raise 3H to four, and the vulnerability and form of scoring might affect your decision.
To see why it is reasonable for you to pass 3H, consider that your partner might have
♠ T ♡ KJ ♢KQT842 ♣ Q853
♠ JT2 ♡ Q73 ♢AQT842 ♣ Q8
or many similar hands, and you will not be able to make 4 hearts between you. (With the first example hand, 4 hearts could quite easily go down three.)
vulnerability and scoring
You should bid close games more aggressively if you are vulnerable and if you are playing IMPs rather than matchpoints.
vulnerable at IMPs, the score for making 4H is +620 and 4H-1 is -100. If you compare against the score for 3H= or 3H+1 then you gain 10 IMPs if the game makes, lose 7 if it goes one off and lose 3 if it goes two or more off (undoubled). So, roughly, any game with a 7/17 chance or more should be bid unless you think two off doubled is a real possibility.
Conversely, at matchpoints, you are just trying to get a better score than the field. Game should be at least 50% for you to bid it. (As always in bridge there are other considerations but they are far less important than "playing the percentages".)
what could partner have done instead?
The 2D call was fine because it is forcing, so partner knows you will not pass.
The 3H call was an error; you were allowed to pass it. Instead:
- a new suit bid (such as 2S or 3C) would have been forcing. Then, whatever you bid, partner could bid 4H themselves at their next turn.
- partner could simply have raised to 4H showing something like 14-17 HCP and three card heart support (they shouldn't have more than 17 or so, otherwise they should investigate a slam).