Drupal 8.7.10 with PHP 7.3.11
Using the option on the settings page does not track the user moving through the site.
The current page seems to reset to the URI of the user when the cache is cleared. Following either menu bar links or book navigation links to other pages in the site does not change the "Current" page passed to the login page. The "?current=" link points to the URI at the time of cache rebuild.
Oddly if I open an Incognito window the current page set at cache rebuild time is carried over into the new Incognito browser window
Turning the caching on or off in the Performance config page does not seem to make any difference
Best to you
Issue fork login_destination-3097721
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
shamilto2000 commentedI'm having exactly the same problem. Any updates on this?
Comment #3
rsvelko commentedQuestion, guys, does this solve it for you?
https://www.drupal.org/project/login_destination/issues/3107857
Comment #4
jurgenr commentedChanging priority to major as this is an important use case of the module.
At this moment the current querystring is set as the node ID of the first loaded page after clearing the cache, which can be any page and causes confusion for users logging in.
Comment #5
mlncn commentedThe issue is very probably that menu blocks are cached per user (same for all pages), when we need them to also be cached per page.
Comment #6
mlncn commentedI used the Blocache (Block Cache Control) module to cache the block that had my menu per page.
A bit confused— i expected to change the footer menu cache to per page per user. Instead the per user part must be coming from the menu and its caching, while the blocks are cached generally by default. So i just added per page (URL) caching. Full configuration can be seen in this commit.
This is a workaround; if possible Login Destination module should identify blocks with login and logout menu links and update them accordingly.
In case it is useful to others, we're discussing the pros and cons of as an alternative to login destination for this purpose here.
Comment #7
remotedots commentedI think #5 is right. as a workaround i disabled the cache for my login block.
Comment #8
gaurav.kapoor commentedI also noticed this issue and it is due to caching of menu links. The solution from https://www.drupal.org/project/login_destination/issues/3107857 doesn't solve it and only possible way is to disable caching for the menu link block. Only functionality affected from this is "Redirect from specific pages" setting isn't working.
Comment #9
gaurav.kapoor commentedThe solution posted in https://drupal.stackexchange.com/a/288669 can also be used to solve caching issue.
Comment #13
nigelcunningham commentedI came across this issue while investigating another issue that's already fixed in dev and have created the merge request, which adds a Trusted Callback pre-render hook, that sets the max-age for the link to zero. We could potentially add cache tags instead; this is just a quick and simple solution.
Updating the branch to 8.x-2.x since that's what I made the PR against.
Comment #14
nigelcunningham commentedComment #15
astringer commentedThe merge request from #13 failed for me. 9.5.3, php 8.1 and 8.x-2.x beta 6(Applied, but I got this WSOD.)
I didn't have time to test it with another theme.
The website encountered an unexpected error. Please try again later.
TypeError: Drupal\bootstrap\Plugin\PrerenderManager::preRender(): Argument #1 ($element) must be of type array, null given in Drupal\bootstrap\Plugin\PrerenderManager::preRender() (line 36 of themes/contrib/bootstrap/src/Plugin/PrerenderManager.php).
Drupal\bootstrap\Plugin\PrerenderManager::preRender(NULL)
call_user_func_array(Array, Array) (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 788)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 374)
Drupal\Core\Render\Renderer->doRender(NULL) (Line: 446)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 94)
template_preprocess_toolbar(Array, 'toolbar', Array)
call_user_func_array('template_preprocess_toolbar', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('toolbar', Array) (Line: 433)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 446)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 83)
__TwigTemplate_474fe8af4d3a856c59ebc5f7c9fa5132->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('themes/custom/itp_bs/templates/system/html.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 433)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 162)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 163)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 174)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 707)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comment #17
prudloff commentedDisabling cache completely seems like overkill, we only need to make the cache vary based on path.
Comment #19
prudloff commentedThe MR now has conflicts.
Comment #20
prudloff commentedRebased the MR.
Comment #21
arousseau commentedMR 5 applies to the current 8.x-2.0-beta8 version and fixes the issue.
The "current" parameter appended to login and logout links varies based on the current page, while it does not without the patch.
It looks ok to merge.
Comment #23
rsvelko commentedTested.
Approved.
Merged.
Fixed.
BTW on my local dev which is drupal 9.x, the current param was working ok.
Still works ok after the latest MR applied.
Probably my local dev is too simple, or the wrong drupal core version.