Fix undefined values in QueryRunPageComponent
Closes #380
Some guidance on this is appreciated. Changing the logic like this resolves the original problem. However, I'm not 100% sure I didn't break something else with this (couldn't find anything yet).