Properly reset item attributes when invalidating layout