Skip to content

Refactor: clean up code smells from PR #151 (catch-expired-session)#156

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/evaluate-code-quality
Draft

Refactor: clean up code smells from PR #151 (catch-expired-session)#156
Copilot wants to merge 2 commits intomasterfrom
copilot/evaluate-code-quality

Conversation

Copy link

Copilot AI commented Feb 27, 2026

Code quality issues introduced in PR #151 across dataManager.element.js and mapbender.element.digitizer.js: duplicated fail-listener construction, an opaque IIFE-curried arrow, minor formatting/spacing inconsistencies, and a misleading comment.

Changes

  • Extract _createFailListener(retryCallback) — the identical 3-line ternary guarding Mapbender.handleAjaxError vs _onAjaxError fallback was duplicated in _loadGrants, postJSON, and _getData; now lives in one place:

    _createFailListener: function (retryCallback) {
        // Mapbender.handleAjaxError only exists in Mapbender >= 4.2.5
        return typeof Mapbender.handleAjaxError === 'function'
            ? (e) => Mapbender.handleAjaxError(e, retryCallback)
            : this._onAjaxError.bind(this);
    },
  • Simplify _loadGrants .then() callback(mergeWith => allGrants => { ... })(this.options.schemes) replaced with a plain arrow function accessing this.options.schemes directly; the IIFE added no value since the callback already captures this.

  • Spacing/formattingonGrantsLoadStarted: function()function () in both files; missing space before (response) in updateMultiple call.

  • Comments — orphaned // setup() called in onGrantsLoadStarted expanded to trace the full call path; // can be overridden by digitizer generalised to // can be overridden by subclasses.

Original prompt

Everyhting good now. Now thoroughly look through the code and detct smells and everything else you would find worth fixing as a senior developer evaluating the PR. Only the things unique to this branch compared to develop

The user has attached the following file paths as relevant context:

  • .github/copilot-instructions.md

Created from VS Code.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: frwg <44997160+frwg@users.noreply.github.com>
Copilot AI changed the title [WIP] Review code for potential improvements and cleanups Refactor: clean up code smells from PR #151 (catch-expired-session) Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants