She did not lose heart, but like David, she expected to see the goodness of God in this life. Jesus commended her faith and granted her desire. He healed her daughter. M en ought always to pray and not lose heart. Jesus was speaking of a time of adversity.
Nobody loses heart when things are going well, only when they seem to be going badly.
Our senses, our thoughts, our emotions may all be telling us there is no hope. Jesus tells us to pray. Which brings me back around to where I began. There is a situation that seems pretty impossible for me. Though I have prayed, God has not yet brought the solution to light.