I have patch for this issue. You need to override these two files.
vendor/magento/module-wishlist/Helper/Data.php
vendor/magento/module-wishlist/Observer/CustomerLogin.php
Override Data.php
and CustomerLogin.php
with di.xml
app/code/{Vendor}/{Module}/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Wishlist\Helper\Data" type="{Vendor}\{Module}\Helper\Wishlist\Data" />
<preference for="Magento\Wishlist\Observer\CustomerLogin" type="{Vendor}\{Module}\Observer\Wishlist\CustomerLogin" />
</config>
app/code/{Vendor}/{Module}/Helper/Wishlist/Data.php
<?php
namespace Vendor\Module\Helper\Wishlist;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Data\Form\FormKey;
use Magento\Framework\App\PageCache\FormKey as PageCacheFormKey;
use Magento\Framework\Session\Config\ConfigInterface;
use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
class Data extends \Magento\Wishlist\Helper\Data
{
/**
* Refresh and set new form_key in session and cookie
*
* @return $this
*/
public function refreshFormKey()
{
$beforeWishlistRequest = $this->_customerSession->getBeforeWishlistRequest();
if ($beforeWishlistRequest !== null) {
$formKeyData = ObjectManager::getInstance()->get(FormKey::class);
//form_key is already empty
$formKey = $formKeyData->getFormKey();
$sessionConfig = ObjectManager::getInstance()->get(ConfigInterface::class);
$cookieMetadata = ObjectManager::getInstance()->get(CookieMetadataFactory::class)->createPublicCookieMetadata();
$cookieMetadata->setDomain($sessionConfig->getCookieDomain());
$cookieMetadata->setPath($sessionConfig->getCookiePath());
$cookieMetadata->setDuration($sessionConfig->getCookieLifetime());
ObjectManager::getInstance()->get(PageCacheFormKey::class)->set(
$formKey,
$cookieMetadata
);
$beforeWishlistRequest['form_key'] = $formKey;
$this->_customerSession->setBeforeWishlistRequest($beforeWishlistRequest);
$this->_customerSession->setBeforeRequestParams($beforeWishlistRequest);
$this->_customerSession->setBeforeModuleName('wishlist');
$this->_customerSession->setBeforeControllerName('index');
$this->_customerSession->setBeforeAction('add');
}
return $this;
}
}
Now remove generated folder and flush cache