Fix #44, Implement a render invalidation flag so that we only render when actually needed