Stop embed form interceptor from blanking trade records after journal save.
Exclude journal-form from InstanceEmbed submit reload, stopImmediatePropagation on AJAX save, and force-reload trades when the table is stuck on loading. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -25,8 +25,13 @@
|
|||||||
const tabPanes = new Map();
|
const tabPanes = new Map();
|
||||||
const tabBooted = new Set();
|
const tabBooted = new Set();
|
||||||
|
|
||||||
/** 自带校验后 form.submit() 的表单,勿在捕获阶段再 fetch 一份(会双发 POST) */
|
/** 自带 AJAX/校验提交的表单,勿在捕获阶段再 fetch+reloadCurrentTab(会卡在「加载中…」) */
|
||||||
const CUSTOM_SUBMIT_FORM_IDS = new Set(["add-order-form", "key-form", "roll-form"]);
|
const CUSTOM_SUBMIT_FORM_IDS = new Set([
|
||||||
|
"add-order-form",
|
||||||
|
"key-form",
|
||||||
|
"roll-form",
|
||||||
|
"journal-form",
|
||||||
|
]);
|
||||||
|
|
||||||
function isEmbedShell() {
|
function isEmbedShell() {
|
||||||
return document.body && document.body.getAttribute("data-embed-shell") === "1";
|
return document.body && document.body.getAttribute("data-embed-shell") === "1";
|
||||||
|
|||||||
@@ -141,10 +141,12 @@
|
|||||||
if (typeof global.validateJournalEntryReason === "function") {
|
if (typeof global.validateJournalEntryReason === "function") {
|
||||||
if (!global.validateJournalEntryReason()) {
|
if (!global.validateJournalEntryReason()) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
if (typeof ev.stopImmediatePropagation === "function") ev.stopImmediatePropagation();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
if (typeof ev.stopImmediatePropagation === "function") ev.stopImmediatePropagation();
|
||||||
submitAjax(form);
|
submitAjax(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -567,14 +567,22 @@
|
|||||||
function init(opts) {
|
function init(opts) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
if (!$("records-panel-root")) return;
|
if (!$("records-panel-root")) return;
|
||||||
|
var tbody = $("rr-trades-tbody");
|
||||||
|
var stuckLoading =
|
||||||
|
!!tbody &&
|
||||||
|
tbody.querySelectorAll("tr").length <= 1 &&
|
||||||
|
/加载中/.test(String(tbody.textContent || ""));
|
||||||
if (booted) {
|
if (booted) {
|
||||||
if (opts.refresh) {
|
if (opts.refresh || stuckLoading) {
|
||||||
loadTradeRecords({ soft: true });
|
loadTradeRecords({ soft: !stuckLoading });
|
||||||
loadJournalsPaged();
|
loadJournalsPaged();
|
||||||
loadReviewsPaged();
|
loadReviewsPaged();
|
||||||
}
|
}
|
||||||
patchFillJournalFromTrade();
|
patchFillJournalFromTrade();
|
||||||
patchDeleteTradeRecord();
|
patchDeleteTradeRecord();
|
||||||
|
if (global.JournalFormSave && typeof global.JournalFormSave.init === "function") {
|
||||||
|
global.JournalFormSave.init();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
booted = true;
|
booted = true;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@
|
|||||||
<script src="/static/time_close_ui.js?v=3"></script>
|
<script src="/static/time_close_ui.js?v=3"></script>
|
||||||
<script src="/static/ai_review_render.js?v=2"></script>
|
<script src="/static/ai_review_render.js?v=2"></script>
|
||||||
<script src="/static/form_submit_guard.js?v=2"></script>
|
<script src="/static/form_submit_guard.js?v=2"></script>
|
||||||
<script src="/static/journal_form_save.js?v=2"></script>
|
<script src="/static/journal_form_save.js?v=3"></script>
|
||||||
<script>
|
<script>
|
||||||
const ORDER_ENTRY_MODEL_TRADE_STYLE = {{ entry_model_trade_style_map | tojson }};
|
const ORDER_ENTRY_MODEL_TRADE_STYLE = {{ entry_model_trade_style_map | tojson }};
|
||||||
const ORDER_ENTRY_MODEL_CATEGORIES = {{ entry_model_categories | tojson }};
|
const ORDER_ENTRY_MODEL_CATEGORIES = {{ entry_model_categories | tojson }};
|
||||||
@@ -110,7 +110,7 @@ const ORDER_ENTRY_MODEL_CODE_TO_CATEGORY = {{ entry_model_code_to_category | toj
|
|||||||
<script src="/static/key_monitor_form.js?v=2"></script>
|
<script src="/static/key_monitor_form.js?v=2"></script>
|
||||||
<script src="/static/instance_stats.js?v=4"></script>
|
<script src="/static/instance_stats.js?v=4"></script>
|
||||||
{% include 'embed_boot_scripts.html' %}
|
{% include 'embed_boot_scripts.html' %}
|
||||||
<script src="/static/records_review_page.js?v=3"></script>
|
<script src="/static/records_review_page.js?v=4"></script>
|
||||||
<script src="/static/options_expiry_countdown.js?v=1"></script>
|
<script src="/static/options_expiry_countdown.js?v=1"></script>
|
||||||
<script src="/static/instance_dashboard.js?v=5"></script>
|
<script src="/static/instance_dashboard.js?v=5"></script>
|
||||||
<script>
|
<script>
|
||||||
@@ -118,6 +118,6 @@ window.__INSTANCE_DISPLAY__ = {{ display | tojson }};
|
|||||||
</script>
|
</script>
|
||||||
<script src="/static/instance_settings_prefs.js?v=14"></script>
|
<script src="/static/instance_settings_prefs.js?v=14"></script>
|
||||||
<script src="/static/instance_live.js?v=6"></script>
|
<script src="/static/instance_live.js?v=6"></script>
|
||||||
<script src="/static/instance_embed.js?v=26"></script>
|
<script src="/static/instance_embed.js?v=27"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -456,7 +456,7 @@
|
|||||||
<script src="/static/time_close_ui.js?v=3"></script>
|
<script src="/static/time_close_ui.js?v=3"></script>
|
||||||
<script src="/static/ai_review_render.js?v=2"></script>
|
<script src="/static/ai_review_render.js?v=2"></script>
|
||||||
<script src="/static/form_submit_guard.js?v=2"></script>
|
<script src="/static/form_submit_guard.js?v=2"></script>
|
||||||
<script src="/static/journal_form_save.js?v=2"></script>
|
<script src="/static/journal_form_save.js?v=3"></script>
|
||||||
<script>
|
<script>
|
||||||
const ORDER_ENTRY_MODEL_TRADE_STYLE = {{ entry_model_trade_style_map | tojson }};
|
const ORDER_ENTRY_MODEL_TRADE_STYLE = {{ entry_model_trade_style_map | tojson }};
|
||||||
const ORDER_ENTRY_MODEL_CATEGORIES = {{ entry_model_categories | tojson }};
|
const ORDER_ENTRY_MODEL_CATEGORIES = {{ entry_model_categories | tojson }};
|
||||||
@@ -2003,7 +2003,7 @@ setInterval(tickOrderHoldDurations, 1000);
|
|||||||
tickOrderHoldDurations();
|
tickOrderHoldDurations();
|
||||||
setInterval(refreshPriceSnapshotConditional, {{ price_refresh_seconds * 1000 }});
|
setInterval(refreshPriceSnapshotConditional, {{ price_refresh_seconds * 1000 }});
|
||||||
</script>
|
</script>
|
||||||
<script src="/static/records_review_page.js?v=3"></script>
|
<script src="/static/records_review_page.js?v=4"></script>
|
||||||
<script src="/static/options_expiry_countdown.js?v=1"></script>
|
<script src="/static/options_expiry_countdown.js?v=1"></script>
|
||||||
<script src="/static/instance_dashboard.js?v=5"></script>
|
<script src="/static/instance_dashboard.js?v=5"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
Reference in New Issue
Block a user