Optimistic UI details - id generation

Has anybody a clue of what the following code does?

EDIT: The code was added in this commit: