Preheat oven to 400 F.
Slice onion thinly. Cut potatoes into 1/4" thick match sticks.
Heat oil in a frying pan at medium heat, and cook potatoes for a few minutes. Add onion and a little bit of salt and pepper. Cook further until the onion softens. Add spinach and mix. Set aside.
In a different pot, melt butter at medium heat, add flour, and cook for a couple of minutes until the sauce bubbles. Add milk and whisk well so there are no lumps. When the sauce thickens, season with 1/2-1 tsp salt and pinch of pepper. Then add crab meat and stir.
Set 1/3 of the sauce aside. Add vegetables to the rest of the sauce and mix. Put the mixture in a baking dish, and pour the remaining 1/3 of the sauce on top. Cover with cheese, and bake in the oven on the upper rack for 25-30 minutes. Remove from the oven and serve garnished with chopped parsley.