Hi team,
Toolset's live preview inside Gutenberg feature while editing specific Views is making it nearly impossible to deal with.
My views have a filter that is set to view custom posts that belong to the "current logged in user".
However while I edit my dashboard page, which has a lot of similar views, the performance is awful because of Toolset-Gutenberg showing non-filtered data, which puts a heavy performance penalty. I even cannot turn on/off "enable pagination" without the editor hanging up, and while using 256M of server RAM.
Is there a way that I can turn off the automatic update inside Gutenberg?
I anyway need to verify the result of my edits in a separate browser while being logged in as a separate non-admin user, so auto-update inside Gutenberg can be ditched since I use the Block navigation tree and Block Settings sidebar mainly, actual preview inside Gutenberg is not that great anyway so if you can share your super-duper custom function that you use to turn off that feature while you troubleshoot development, that'd awesome!
Hi,
Thank you for contacting us and I'd be happy to assist.
The preview screen in the Gutenberg editor is an integral part, so it won't be possible to disable it.
However, to improve the performance, you can follow these steps:
1. You can disable or decrease the frequency of the 'auto save' feature in the Gutenberg. Here are some useful guides on the topic:
enlace oculto
enlace oculto
2. You can limit the number of results, that the view blocks show in the Gutenberg preview, using the "wpv_filter_query" filter:
( ref: https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query )
For example, the following code snippet will limit the number of results shown in all view block previews to '1':
( on the front-end, the number of results will be unaffected )
add_filter( 'wpv_filter_query', 'wpv_filter_query_func', 1000 , 3 );
function wpv_filter_query_func( $query_args, $view_settings ) {
// if it is the Gutenberg editor screen
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
$query_args['posts_per_page'] = 1;
}
return $query_args;
}
The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through the active theme's "functions.php" file.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar