H5P slow saves

  1. Detailed steps to reproduce the bug (exactly how and when did it happen)

On drupal v8.9.19, H5P plugin verrsion 8.x-1.0-rc19

Create a content type with a multivalued h5p field

create a node using this content type with a lot of H5p content

Save, it is slow (normal because it has to process the content)

Edit

Save again => It is slow again because it reprocesses everything

On our installation I modified the file H5PEditorWidget.php on line 149 to address this issue. I added those lines:

    // Skip saving if the content has not changed

    if ($value['id'] && !empty($h5p_content) &&

      $old_params == $params->params && 

      $h5p_content->getMetadata()["title"] == $params->metadata->title) {

      return $return_value;

    }

It is not perfect because it does not check all metadata and other things but it is okay for our use case. If you could implement something generic along thiese lines I think it may help a lot for other users who had performance issues.