The Diamondbacks had this one right where they wanted it for a minute — and then the ninth inning turned into one of those baseball endings that leaves everybody in the Valley shaking their head on the drive home.

Arizona and Texas played a tight game that came down to the final frame, with the D-backs making a late push before the Rangers answered back in a frantic ninth and finished things off on a walk-off hit by Kenley Jansen. It was the kind of finish that can swing from hopeful to heartbreaking in a matter of pitches.

For D-backs fans, it had all the ingredients of a road win that would feel especially good. Arizona battled deep into the game, stayed within striking distance, and gave itself a chance to steal it late. But Texas kept hanging around, and once the Rangers got their opening in the ninth, they made the most of it.

That’s the tough part about baseball, especially in a game like this. You can do a lot right for eight innings and still end up empty-handed if the last few outs get away from you. The D-backs found that out the hard way.

The loss is the kind that stings because it was so close. Arizona didn’t get blown out or fade early. Instead, it was right there in a game that felt like it could go either way, which makes the ending even harder to swallow. Those are the ones fans remember — the ones where one inning changes everything.

For the Rangers, though, this was exactly the sort of win a team loves to have in front of its home crowd. A late rally, a tense finish, and then a walk-off hit to send everyone home happy. Jansen’s hit capped the comeback and gave Texas a dramatic finish after Arizona had pushed them to the edge.

If you’re following the D-backs from here in Phoenix, this one probably lands as a missed opportunity more than anything else. Chase Field has seen its share of wild endings, and this had that same familiar feel: a game that was there to be won, then slipped away in the final moments.

The good news for Arizona is that one game doesn’t define a season, even if it can feel that way for a night. The D-backs have shown they can hang in games like this, and that matters over the long haul. Still, when you’re in a close one and the ninth inning goes sideways, it’s hard not to replay every pitch in your head.

That’s especially true for a team trying to keep momentum going in a crowded National League race. Every close game matters, and the margin for error gets smaller the deeper you get into the season. A finish like this can be a reminder that the little things — one extra hit, one clean inning, one better pitch in the ninth — can make all the difference.

For now, the D-backs head back to the drawing board after a game that was almost theirs. Texas gets the celebration, Arizona gets the lesson, and everybody else gets one more reminder that baseball can flip in a heartbeat.

And if you were watching from the Valley, you probably know the feeling: one second you’re thinking, “They’ve got this,” and the next you’re staring at the final score wondering how it got away.