When buying a home, how much do you weigh commutable distance to work?

Title.

When looking for a house, how much is a factor of the distance/time you commute to work? Obviously, it’s a consideration but with jobs not being permanent (people switching) or work structures changing (return to office mandate), how much do you consider it?

Like let’s say you buy a house near downtown of your city because your job is there, and then you switch to a job 30-45 min away. Or you get laid off.

Or you pick a place a little further out becuase you’re hybrid but then the company says full five days in office, that extra two days commuting is really going to add up.

Thanks in advance!