The pandemic hurt small retailers by hastening the transition to digital commerce and emptied office buildings by turning living rooms into workspace. But it also fueled a warehouse building boom and unleashed a torrent of pent-up travel-and-leisure spending when economies reopened, underscoring the diversity of commercial real estate.