Automatically closed - issue fixed for 2 weeks with no activity.
Each step after the first creates an entry in the key_value_expire table.
That's because simple_multistep_register_next_step()
calls setRebuild()
, which generates a different build ID for the form.
Drupal clears the cache when the form is submitted, but because simple_multistep rebuilds the cache in a validate function, the submit is never reached until the end of the form. Then the submit only clears the cache of the last page.
This is usually not a problem because the form cache is small and it expires after 6 hours.
However, if you have a big form with a lot of pages, it can use a lot of database space.
As a workaround we manually delete the cache entry for the previous page on each form rebuild:
if ($oldBuildId = $form_state->get('old_build_id')) {
/** @var \Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface $formCache */
$formCache = Drupal::service('keyvalue.expirable');
$formCache->get('form')->delete($oldBuildId);
$formCache->get('form_state')->delete($oldBuildId);
}
$form_state->set('old_build_id', $form['#build_id']);
However, this breaks if the user reloads a page and resends the same POST request (the build ID corresponding to the request does not exist anymore so the first page is displayed instead.
Fixed
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Automatically closed - issue fixed for 2 weeks with no activity.