Convention for sorting within a sort on grids

The convention of a sort-able grid seems to be well established. A user sorts on a column by clicking on the header and an arrow appears indicating the direction of the sort. However when the column that is sorted contains many duplicates within the grid the sorting is not well defined for the items in the same category.

Somehow I seem to remember that the previous sorting state should be kept for items that are grouped in the same sort key category. However the behavior I observed may have been due to the implementation of the grids I've played with, because however I haven't been able to find any source on the internet to establish my hypothesis.

The Windows File Explorer for instance seems to always sort secondarily on the filename in the same sort direction. When you sort ascending on file type it sorts within the same type ascending on file name. When you sort descending on file type it sorts within the same type descending on file name.

Is there a convention for secondary sorting I'm unaware of or should we implement whatever is most convenient for a specific grid? Also does it really matter?