                                             @disable_toggle_executing = false
                                             @toggle_executing false
 
-                    state.query_result = query_result
+                    dataexplorer_state.query_result = query_result
 
                     @results_view_wrapper.set_query_result
-                        query_result: state.query_result
+                        query_result: dataexplorer_state.query_result
 
                 @disable_toggle_executing = false
                 @driver_handler.run_with_new_connection rdb_query,
                     optargs:
                         binaryFormat: "raw"
                         timeFormat: "raw"
-                        profile: state.options.profiler
+                        profile: dataexplorer_state.options.profiler
                     connection_error: (error) =>
                         @save_query
                             query: @raw_query

    # We give this button an "active" class that make it looks like it's pressed.
    toggle_pressed_buttons: =>
        if @history_view.state is 'visible'
            state.history_state = 'visible'
            @$('.clear_queries_link').fadeIn 'fast'
            @$('.close_queries_link').addClass 'active'
        else
            state.history_state = 'hidden'
            @$('.clear_queries_link').fadeOut 'fast'
            @$('.close_queries_link').removeClass 'active'

        if @options_view.state is 'visible'
            state.options_state = 'visible'
            @$('.toggle_options_link').addClass 'active'
        else
            state.options_state = 'hidden'
            @$('.toggle_options_link').removeClass 'active'

    # Show/hide the history view

r = require('rethinkdb')


dataexplorer_state =
    current_query: null
    query_result: null
    cursor_timed_out: true
