I suggest trying it like this first:
<%= for class <- @classes do %>
<div id={"class-item-" <> class.id}>
Class: <%= class.title %> - Archived <%= class.archived %>
# ...
In your original example the immediate text is not keyed in any way, and as far as I understand, it’s the problem. Google for keyed vs non-keyed DOM updates for more info.
Here’s an interactive example: Logic / Keyed each blocks • Svelte Tutorial