The Prophet of Allah ﷺ came upon a woman who was weeping over her young child. He said to her, "Fear Allah and be patient."She replied, "What concern is my misfortune to you?"She was then told, "This is the Prophet ﷺ."So she came to him, and finding no doorkeepers at his door, she said, "Messenger of Allah, I did not recognize you."He said, "True patience is at the first shock," or "at the first moment of calamity."
حدثنا محمد بن المثنى حدثنا عثمان بن عمر حدثنا شعبة عن ثابت
أتى نبي الله ﷺ على امرأة تبكي على صبي لها فقال لها اتقي الله واصبري فقالت وما تبالي أنت بمصيبتي فقيل لها هذا النبي ﷺ فأتته فلم تجد على بابه بوابين فقالت يا رسول الله لم أعرفك فقال إنما الصبر عند الصدمة الأولى أو عند أول صدمة
Bukhari reported it in the Book of Funerals, chapter "A man's saying to a woman at the grave, 'Be patient,'" no. 1252, and Muslim in the Book of Funerals, chapter "On patience at the first shock of calamity," no. 926, from the hadith of Shubah.