Reset headings only when the headers are not equal to the previous ones. It will prevent unnecessary rerenders.