Prepare the oven: Preheat the oven to 400°F. Line two to three baking sheets with parchment paper.
Cook the aromatics: Heat olive oil in a small skillet over medium heat. Add the chopped onion, garlic, and crushed chili flakes. Cook for 3 to 4 minutes, until softened and translucent.
Cool the onion mixture: Transfer the cooked ingredients to a mixing bowl and allow them to cool.
Prepare the filling: Add the thawed, squeezed spinach and drained, chopped artichokes. Stir in the grated Gruyère and Parmesan. Season with kosher salt and freshly ground black pepper to taste.
Prepare the pastry: Unfold or unroll one sheet of thawed puff pastry onto a lightly floured work surface. Lightly flour both sides if the pastry feels wet or sticky.
Add the filling: Position the pastry with its longer sides running horizontally. Spread half of the spinach-artichoke mixture evenly over the surface, leaving a ½-inch border.
Make the egg wash: Beat the egg with one tablespoon of water in a small bowl.
Roll the pastry: Brush the far edge of the pastry with a little egg wash. Starting from the edge closest to you, roll the pastry away from yourself into a jelly-roll-style log. Seal the edge with the egg wash.
Prepare the second log: Repeat the process using the second pastry sheet and the remaining filling.
Chill if necessary: If the pastry logs are too soft to slice cleanly, place them in the freezer for approximately 10 to 15 minutes.
Slice the pinwheels: Cut each log into ½-to-¾-inch-thick slices.
Arrange on baking sheets: Place the slices flat on the prepared baking sheets, approximately 2 inches apart.
Apply egg wash: Lightly dab the tops and sides of each pinwheel with the remaining egg wash.
Bake: Bake for 25 to 30 minutes, rotating the baking sheets from top to bottom and front to back partway through.
Check for doneness: Remove the pinwheels when the pastry is golden brown and the cheese filling is bubbly.
Serve: Carefully remove the pinwheels with a spatula. Serve warm or at room temperature.