27805: Simplify logic for prepreview_added_widget_instance

Re-use JS variable instead of running another query