Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug Toolbar - Fix Debugbar-Time header, Render in <head> #2494

Merged
merged 1 commit into from
Jan 17, 2020

Conversation

najdanovicivan
Copy link
Contributor

Description

  • There is an issue with Debugbar-Time not being set correctly XHR response when integer value is set. This fixes the toolbar to pick up changes on Ajax request

  • Debug toolbar scripts should be rendered immediately the beginning of in order to pick up Ajax requests which happens on document load.

Checklist:

  • Securely signed commits
  • Component(s) with PHPdocs
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

…<head>

 - There is an issue with Debugbar-Time not being set corretly XHR respspone when integer value is set. This fixes the toolbar to pick up changes on ajax request

- Debug toolbar scripts should be rendered immedeately the beginning of <head> in order to pick up ajax requests which happens on document load.
@lonnieezell lonnieezell merged commit 01fd252 into codeigniter4:develop Jan 17, 2020
@najdanovicivan najdanovicivan deleted the debug-toolbar-fix branch January 17, 2020 23:41
@buddzph
Copy link

buddzph commented Jun 23, 2022

Hi,

I have this fixed that might help.

system/debug/toolbar/views/toolbarloader.js.php line 75. Add the condition below:

# if (realXHR.getAllResponseHeaders().indexOf("Debugbar-Time") >= 0) {

complete code:

if (realXHR.readyState === 4 && realXHR.status.toString()[0] === '2' && realXHR.responseURL.indexOf('debugbar_time') === -1) {
            if (realXHR.getAllResponseHeaders().indexOf("Debugbar-Time") >= 0) {
                var debugbarTime = realXHR.getResponseHeader('Debugbar-Time');
                if (debugbarTime) {
                    var h2 = document.querySelector('#ci-history > h2');
                    if (h2) {
                        h2.innerHTML = 'History <small>You have new debug data.</small> <button onclick="loadDoc(' + debugbarTime + ')">Update</button>';
                        var badge = document.querySelector('a[data-tab="ci-history"] > span > .badge');
                        badge.className += ' active';
                    }
                }
            }
		}

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.

3 participants