Add the onion and cook until softened, about 3 minutes. Add all-purpose flour and cook, whisking constantly, until the floury taste is gone, about 1 minute.
Whisk in egg yolks one at a time, fully incorporating each before adding the next. Stir in the Gruyère, spinach, and 1 ounce Parmesan until well combined.
dd the remaining egg whites and gently fold with a spatula until just combined with no large streaks. Transfer the mixture to the baking dish and smooth the top.