More recently, the growth of the Tea Party movement during the presidency of Barack Obama produced notably sharp fractures among Republicans that ended the careers of several leading politicians, but it did not prevent Republican candidates from netting 70 House seats and 14 Senate seats between 2010 and 2014.

Political commentators often suggest that national parties maximize their electoral effectiveness when they push a single policy program or message. But the Democratic Party is organized as a coalition of social groups and best served when candidates are free to shape individual campaign appeals tailored to the interests of their own constituencies. Rather than acting as a single party “base” with a common set of policy goals or ideological commitments, Democratic supporters are made up of a diverse array of social groups strewn across state and district boundaries, each with its own agenda of political concerns and quest for representation among the party leadership. Mobilizing the collective Democratic faithful from coast to coast therefore requires a variety of distinct campaign messages — and messengers.

The differing complexion of the Democratic electorate from one place to another also helps to explain why pressure from party liberals for greater ideological purity (and a more confrontational approach toward the Trump administration) is not evenly distributed across the nation. While veteran blue-state officeholders like Mr. Crowley, Gov. Andrew Cuomo of New York and Senator Dianne Feinstein of California face intraparty challengers from the left, moderate Senate Democrats facing re-election in red states have all either won their primaries or appear on the way to renomination without fear of serious contestation.

As a result, the widespread surge of anti-Trump activism over the past two years has not endangered Democratic electoral prospects by producing a raft of candidates who are poor fits for the broader voting public in their home seats. Special-election nominees like Doug Jones and Conor Lamb have received enthusiastic support from liberal activists despite keeping their distance from the left wing of the party.

If the Democratic Party is undergoing a transformation in the Trump era, it is less ideological than compositional. The party has already nominated a record number of women for Congress in 2018, many of whom are running for competitive seats now held by Republicans. At least three Hispanic Democrats (including Ms. Ocasio-Cortez) are poised to succeed white incumbents in majority-minority House districts. And the November election is also likely to produce the first Eritrean-American and female Native-American members of the legislative branch.