Why is it that when the rope is stretched straight and breaks suddenly, the tension of the rope will disappear instantly, while when both sides of the spring are stretched with the rope (or compressed with other methods), when the rope is broken, or when other parts are relaxed, the elasticity of the spring will not disappear instantly?

Why is it that when the rope is stretched straight and breaks suddenly, the tension of the rope will disappear instantly, while when both sides of the spring are stretched with the rope (or compressed with other methods), when the rope is broken, or when other parts are relaxed, the elasticity of the spring will not disappear instantly?

Because the spring is not broken
As mentioned above, the tension of the rope disappears when it breaks. Now the rope on both sides of the spring breaks and the tension of the rope disappears. However, the deformation of the spring still exists. It is impossible to say that the deformation disappears at the moment when the rope breaks (inertial action), so the elastic force will not disappear instantly