-
Notifications
You must be signed in to change notification settings - Fork 1.1k
1843 new ajax request resets whole view if historypanel is enabled #1872
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
Changes from 8 commits
096fdf4
f499e41
73c96eb
def324a
150e11b
0419cd7
c6d3b65
bd2a24e
d23bbd2
5c3da4c
1d2ed26
4cb7900
20fad64
59e6a28
43a6966
ba03e9f
0fa7647
ea556df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ const djdt = { | |
handleDragged: false, | ||
init() { | ||
const djDebug = getDebugElement(); | ||
window.djdt.update_on_ajax = djDebug.getAttribute("update-on-ajax") === "True"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not completely consistent but we generally prefer using Also, other parts of the code use the dataset attribute, so this should be I wonder if there is a better place for this property though. Tim suggested using localStorage to allow switching between the auto update and manual update behavior on the fly, and this probably wouldn't work with the way it's proposed here. Also, I don't think we want to expose the attribute to external modification (just yet). Putting it in the same place as the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For some context, when Elineda and I spoke yesterday, we decided we could start with a settings control. If we find that it doesn't meet developers needs, we can add the JS to make it more stateful. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did change asked, but I don't put on a localstorage, I just with handleDragged. |
||
$$.on(djDebug, "click", "#djDebugPanelList li a", function (event) { | ||
event.preventDefault(); | ||
if (!this.className) { | ||
|
@@ -55,6 +56,7 @@ const djdt = { | |
detail: { panelId: panelId }, | ||
}) | ||
); | ||
|
||
tim-schilling marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
} else { | ||
djDebug.dispatchEvent( | ||
|
@@ -274,7 +276,9 @@ const djdt = { | |
storeId = encodeURIComponent(storeId); | ||
const dest = `${sidebarUrl}?store_id=${storeId}`; | ||
slowjax(dest).then(function (data) { | ||
replaceToolbarState(storeId, data); | ||
if (window.djdt.update_on_ajax){ | ||
replaceToolbarState(storeId, data); | ||
} | ||
}); | ||
} | ||
|
||
|
@@ -356,6 +360,7 @@ window.djdt = { | |
init: djdt.init, | ||
close: djdt.hideOneLevel, | ||
cookie: djdt.cookie, | ||
update_on_ajax: false, | ||
}; | ||
|
||
if (document.readyState !== "loading") { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ Pympler | |
Roboto | ||
Transifex | ||
Werkzeug | ||
ajax | ||
async | ||
backend | ||
backends | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
<div id="click_for_ajax">click for ajax</div> | ||
|
||
<script> | ||
|
||
let click_for_ajax = document.getElementById("click_for_ajax") | ||
function send_ajax() { | ||
let xhr = new XMLHttpRequest(); | ||
let url = '/json_view/'; | ||
xhr.open("GET", url, true); | ||
xhr.onreadystatechange = function () { | ||
if (this.readyState == 4 && this.status == 200) { | ||
console.log(this.responseText); | ||
} | ||
} | ||
xhr.send(); | ||
} | ||
document.addEventListener("click", (event) => {send_ajax()}); | ||
</script> | ||
{% endblock %} |
Uh oh!
There was an error while loading. Please reload this page.