Show message after asynchronous requests for expired sessions with option to retry#151
Open
Show message after asynchronous requests for expired sessions with option to retry#151
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds session-expiration handling for asynchronous requests by leveraging Mapbender.handleAjaxError (Mapbender >= 4.2.5) and introduces a retry hook so users can re-authenticate in another tab and retry operations without losing changes.
Changes:
- Refactor grants loading into
_loadGrantsand add an overridableonGrantsLoadStartedhook. - Extend request helpers (
postJSON, item fetch) to useMapbender.handleAjaxErrorwith a retry callback when available. - Update Digitizer initialization to wait for “map ready + grants loaded” via the new hook.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Mapbender/DigitizerBundle/Resources/public/mapbender.element.digitizer.js | Switches Digitizer setup/start to the new grants-loading hook and updates a postJSON call to use the new callback pattern. |
| src/Mapbender/DataManagerBundle/Resources/public/dataManager.element.js | Adds retry-aware grants loading and AJAX helpers; changes postJSON signature to accept an optional success callback. |
| CHANGELOG.md | Documents the new session-expiration / retry behavior. |
Comments suppressed due to low confidence (1)
src/Mapbender/DataManagerBundle/Resources/public/dataManager.element.js:1
- Same retry-chaining issue as in
_loadGrants: if the first request fails, the returnedpromiseis rejected and stays rejected even if the user retries and the retried request succeeds. This can break caller flows that rely on the returned promise (e.g., closing dialogs, resuming tool state, subsequent.then(...)chains). Consider implementing the retry handling by returning the retried promise from the failure handler so the original call completes successfully after retry.
(function ($) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
only works when using the latest mapbender (>= 4.2.5)
when the session expires, login in another window and then click on retry to make sure no changes are lost.