wp_nav_menu work in functions.php but not in the theme

I had a pre_get_posts. What I missed was this:

&& $wp_query->is_main_query()

This prevents the pre_get_posts to run on the menu query.

Full code

add_action("pre_get_posts", "custom_front_page");
function custom_front_page( $wp_query ){
    if( is_admin() ) {
        return;
    }

    if( is_front_page() && $wp_query->is_main_query() ) {
        $wp_query->set('post_type', 'produkt');
        $wp_query->set('page_id', ''); 

        $wp_query->is_page = 0;
        $wp_query->is_singular = 0;
        $wp_query->is_post_type_archive = 1;
        $wp_query->is_archive = 1;
    }
}