Gravity isn’t instantaneous, but only travels at a limited speed:
The Speed of light.
And that gravitation isn’t determined by mass and position directly, but by the curvature of space, which itself is determined by the full suite of matter and energy throughout the Universe.
Action-at-a-distance was here to stay, but Newton’s “Infinite range force through static space” was replaced by spacetime curvature.
If the Sun were to simply wink out of existence, disappearing from the Universe, we wouldn’t get to know it for some time.
Earth wouldn’t immediately fly-off in a straight line; it will continue orbiting the Sun’s location for another 8 minutes and 20 seconds.
It isn’t mass that determines Gravitation, but rather the curvature of space, which is determined by the sum of all the matter and energy in it.
If you were to take the Sun away, space would go from being curved to being flat, but that transformation won’t be instantaneous.
Because spacetime is a fabric, that transformation would have to occur in some sort of snapping motion.
You know how Thanos ‘snapped’ everyone out of existence!
That snap would send very large ripples of gravitational waves through the Universe, propagating outward like ripples in a pond.
Like, the way they show you in End Game. Large amounts of energy hurling through the Universe; a large energy outburst thing.
P.S. Always pay attention.