There will eventually come a time in your investing career when you'll realize there are stocks you sold too early. Maybe it looked as if the stock was surpassing its growth potential or moving into troubled territory, but instead, it continued soaring. For me, these stocks were Boston Properties (BXP 2.57%) and Federal Realty Trust (FRT 1.26%).

These two real estate investment trusts (REITs) were hard hit by the pandemic, putting the stocks' future in a questionable position. But two years later, the companies are proving to be much more resilient than I imagined. Here's a closer look at why I wish I hadn't sold when I did.

Person in a coffee shot looking at a tablet computer.

Image source: Getty Images.

1. Boston Properties

Boston Properties is a premier office REIT specializing in the development and management of 201 high-end, Class-A office properties primarily in the central business districts (CBD) of Boston, Los Angeles, New York, San Francisco, Washington D.C., and Seattle. Big cities in particular, including the six markets Boston Properties operates in, were crushed by the coronavirus pandemic, with residents fleeing the cities in search of more affordable housing because they could work from home. From February to March 2020, Boston Properties' stock fell nearly 47%.

Following the advice of some fellow Fools, I decided to invest in Boston Properties in late 2020, while the company was still trading at a notable discount. I held on to the stock for roughly one year before I started to have concerns about where the market was headed and whether office space would truly recover. Initial plans for office reopenings were shelved as new variants of the virus spread quickly and vaccine effectiveness was challenged.

While things are improving in some aspects, Boston Properties hasn't fully recovered. Revenue, net operating income (NOI), and funds from operations (FFO), a key metric of REIT performance, are improving year over year but still are below pre-pandemic levels. Leasing levels are trending down, with 88% of the company's portfolio leased at year's end 2021, 5% less than pre-pandemic levels.

Selling when I did means I avoided some of the risk surrounding the future of office space while still benefiting from a 41% share price growth during that time. But I also missed out on the shares' continued growth today. I should have more heavily considered the fact that Boston Properties provides top-of-the-line office designs. Their likelihood for a comeback is greater as the demand for office features shifts and cities begin to recover. If I had taken a calmer, long-term approach, I would have benefited from share prices continuing to rise. 

2. Federal Realty Trust

Like offices, the retail industry was hard hit by the global pandemic. Federal Realty Trust, which operation and leases 104 urban mixed-use properties and open-air shopping centers, saw share prices plummet about 45% in just a couple of weeks in March 2020.

Again, thanks to a recommendation from a fellow Fool, I purchased shares of Federal Realty Trust in September 2020 while share prices were still undervalued. Retail made a strong comeback over the next year, with growing demand for open-air shopping centers helping my investment grow more than 65% during that year. I decided to sell shares in Federal Realty Trust in October 2021 to cash out my investment and diversify into alternative opportunities that could provide better growth opportunities. 

During that year, I earned a solid 5.8% dividend return from a high-quality company with an incredible real estate portfolio. While the retail sector may not provide huge growth opportunities during the next 10 years as it battles the pandemic landscape and rise of e-commerce, I underestimated the value of my dividend return. Because I purchased when share prices were low, I was earning a competitive dividend return with share prices still having room to grow. Today share prices are up 74% from my time of purchase, even with market volatility.

Of course, buying low is an ideal scenario for investing -- it means you have more upside potential for growth and higher opportunities for returns. But my biggest lesson from this investing mistake is that patience and letting investments grow over the long term often outweigh any discounted value I may have purchased. Selling too soon means I may have missed out on long-term potential and given up reliable dividend income. Fortunately, there's no shortage of new opportunities to invest in today's market.