Make gnocchi: Drain ricotta in a strainer over sink, stirring occasionally, 1 hour.
In a large bowl, combine 3 cups sweet- potato purée (save extra for another use), strained ricotta, sugar, cheese, salt, and nutmeg. Gently stir in flour, 1/2 cup at a time, until a soft dough forms.
Working on a floured surface, divide dough into 8 portions. Roll each portion with your hands into a 15-in. rope, then cut into 1-in. pieces, sprinkling dough with flour if it gets sticky. Transfer gnocchi to a rimmed tray lightly dusted with flour.
Bring a large pot of salted water to a boil. Reduce heat to medium-low. Working in batches of 15 to 20, drop gnocchi into water, stirring to prevent sticking, and cook until gnocchi are firm and float to top of water, about 5 minutes. Using a slotted spoon, transfer gnocchi to a strainer and then to a lightly oiled rimmed pan to cool.
Assemble gnocchi: Heat 2 tbsp. oil in a large nonstick frying pan over medium-high heat. Add gnocchi to pan and cook, stirring often, until browned, 5 to 8 minutes. Transfer to a large serving dish.
Meanwhile, heat remaining 2 tbsp. oil in a second large frying pan over medium-high heat. Cook garlic and shallots until fragrant, about 2 minutes. Add mushrooms and sauté until softened, about 5 minutes. Add broth, butter, spinach, salt, and pepper; cover and cook until spinach wilts, about 3 minutes.
Spoon vegetables over gnocchi and pour in broth. Sprinkle with thyme and half of parmesan. Serve with remaining cheese.
*Leave whole any soft mushrooms such as oysters and slice or quarter large, dense mushrooms like the cremini and king trumpets.
Make ahead: Prepare through step Cover and chill up to 3 days or freeze up to 3 weeks.
Note: Nutritional analysis is per serving.