Yes that was introduced back in photoshop 2020 and it's called Zoom to a layer's contents
Zoom to a layer's contents
In the Layers panel, Alt+click (Win) / Option+click (Mac) on a layer to zoom to that layer's contents. Alternatively, you can also choose View > Fit Layer(s) To Screen from the menu bar.