Modify GenerateBlocks query loop pagination parameters

GenerateBlocks query loop has a few hidden filters in its arsenal. One of the is the generateblocks_query_loop_args filter that can affect the WP Query parameters of the loop. As an example, one of my latest projects made use of a sidebar block element that contained a post loop displaying the latest 5 posts. Since this was displayed in the post archives, I made use of the Inherit query from template query parameter so that the posts displayed in the post loop would be related to the current category archive.

Inherit query from template parameter
Inherit query from template parameter

The issue with this solution is that, as of version 1.6.0, all other parameters including number of posts per page, became unavailable and the number of posts displayed are inherited from the Blog settings found at Settings-> Reading.

Blog reading settings
Blog reading settings

As a result, I needed to modify the query to only show 5 posts at a time. I did that by assigning a class to the post query grid block and using the following code in my functions.php file to reference that class.

add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) {
    if ( ! is_admin() && ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'my-class-name' ) !== false ) {
        $query_args['posts_per_page'] = 5;
    }
    return $query_args;
}, 10, 2 );

The class in question is the my-class-name, please replace it with your own.