The six-month window to arrive at a permanent replacement for the Deferred Action for Childhood Arrivals program is about to close, and Congress is scrambling to reach a deal acceptable to the White House.

But the president isn’t making it easy. On last Tuesday, Mr. Trump called for “a bipartisan bill of love” and promised not to quibble about details, as long as it contained funding for “the wall.” On Thursday, he suggested that an acceptable deal will restrict immigration from “shithole countries” in Latin America, the Caribbean and Africa.

Democrats are piqued, but they must not let Mr. Trump’s incoherence and prejudice keep them from signing on to a deal — even one that includes wall funding. The future of nearly 800,000 Dreamers — young undocumented immigrants — is on the line. Those of us who care about our innocent friends and neighbors brought to America as children won’t gamble with their lives.

Democrats are feeling bullish. With a midterm wave, the House seems like a lock. Even a Senate majority now seems within reach. With spirits so high, some Democrats will be tempted to indulge in best-case-scenario thinking.