What happened

Shares of solar panel installer Sunrun (RUN -1.75%) are up 72.3% so far in 2019, according to data provided by S&P Global Market Intelligence. Shares rose at a steady clip in the first two months of the year, but stalled in March and April before resuming an upward trajectory in May and June. 

So what

Sunrun's last six months are basically divided into three acts. Act I saw the company report solid performance in Q4 2018 and, in the words of CEO Lynn Jurich from the earnings call, introduce "guidance for growth to accelerate in 2019, unit margins to expand further, and cash generation to grow by more than 50% to over $100 million."

A girl in oversized sunglasses looks upwards towards the sun

Sunrun is the largest residential solar installer in the U.S. But can it outperform? Image source: Getty Images.

That all sounded good, and shares reacted accordingly. But Act II introduced a new wrinkle in the form of Tesla (TSLA -3.76%), which announced in late April that it was slashing the prices of its solar installations. Initial reports indicated that Tesla might undercut the price of traditional installers by as much as 38%, but that number was later recalculated to something in the neighborhood of 10%. Still, shares of Sunrun and other installers fell on fears of increased competition. They fell again in early May, after the company reported weak Q1 2019 earnings. 

But in Act III, the market realized something: California -- where Sunrun is based -- has mandated that solar panels be included in all new construction by 2020. That should open up huge demand for solar installation, and Sunrun is poised to benefit. The company has been spending a lot of money trying to drum up sales, but if those sales are essentially mandated in the nation's most populous state, that could allow Sunrun to cut expenses and grow revenue at the same time. Its shares soared after Goldman Sachs pointed this out in June and simultaneously upgraded the stock. 

Now what

California's impending solar mandate could be the secret sauce that Sunrun has been looking for to allow it to flourish. But other installers -- including California-based Tesla -- will also be looking to get in on the action. 

In the meantime, there are other concerns about the business, including its rising debt and the questionable way it values its installed solar assets on its balance sheet. You may decide that the potential opportunity offered in California outweighs those concerns, but be aware that if you buy in now, the big-growth thesis for the stock essentially puts all its eggs in one basket. If that doesn't come to fruition for some reason, shares are likely to suffer.