     (conj (mapv #(hash-map :value % :title %) emails)  {:value "all" :title (t :badge/All)})))
 
 (defn badges-for-grid [state]
-  (let [badges (if (= "all" (:email-selected @state))(:badges @state) (filter #(= (:email-selected @state) (:email %)) (:badges @state)))]
-    (swap! state assoc :current-view-badges badges)
-    badges))
+  (if (= "all" (:email-selected @state))(:badges @state) (filter #(= (:email-selected @state) (:email %)) (:badges @state))))
 
 (defn visibility-options []
   [{:value "all" :title (t :badge/All)}

             (empty? (:badges @state)) (t :badge/Nobadgestoexport))]
          [:div
           [badge-grid-form state]
           [select-all-button state]
           (if (not (nil? (:backpack_id (first (filter #(= (:email %) (:email-selected @state)) (:emails @state))))))
             [:button {:class    "btn btn-primary"
                       :on-click #(export-badges state)
                       :disabled (= 0 (count (:badges-selected @state)))}
              (t :badge/Exportselected)])
           [:button {:class "btn btn-primary"
                     :on-click #(do (.preventDefault %)
                                     (swap! state assoc :pdf-option "default")
                                         (m/modal![export-to-pdf-modal state] {:size :lg}))
                     :disabled (= 0 (count (:badges-selected @state)))}
            (t :badge/Exporttopdf)]
           [badge-grid state]])]))])

(defn init-data [state]

   [g/grid-select        (t :badge/Email ":") "select-email" :email-selected (email-options state) state hard-reset]
   [g/grid-search-field  (t :badge/Search ":") "badgesearch" (t :badge/Searchbyname) :search state soft-reset]
   [g/grid-select        (t :badge/Show ":") "select-visibility" :visibility (visibility-options) state soft-reset]
   [g/grid-buttons       (t :badge/Tags ":") (unique-values :tags (badges-for-grid state)) :tags-selected :tags-all state soft-reset]
   [g/grid-radio-buttons (t :badge/Order ":") "order" (order-radio-values) :order state]])

(defn badge-visible? [element state]
