|
829 | 829 | endDate: loadedEndDate, |
830 | 830 | centerDateOverride: centerDateEl.value, |
831 | 831 | append: false, |
| 832 | + suppressPendingFocus: true, |
832 | 833 | }); |
833 | 834 | if (tableWrapEl) { |
834 | 835 | tableWrapEl.scrollTop = prevScrollTop; |
|
977 | 978 | }; |
978 | 979 | } |
979 | 980 |
|
| 981 | + function clearPendingFocus() { |
| 982 | + pendingFocus = { date: "", field: "distance" }; |
| 983 | + } |
| 984 | + |
980 | 985 | function mergeSavePayload(existingPayload, incomingPayload) { |
981 | 986 | const base = existingPayload && typeof existingPayload === "object" ? existingPayload : {}; |
982 | 987 | const next = incomingPayload && typeof incomingPayload === "object" ? incomingPayload : {}; |
|
1011 | 1016 | if (!isIsoDateString(dateKey)) return; |
1012 | 1017 | const nextPayload = mergeSavePayload(pendingPlanSaves.get(dateKey), payload || {}); |
1013 | 1018 | pendingPlanSaves.set(dateKey, nextPayload); |
1014 | | - if (isIsoDateString(nextFocusDate) && !preserveFocus) { |
| 1019 | + if (preserveFocus) { |
| 1020 | + clearPendingFocus(); |
| 1021 | + } else if (isIsoDateString(nextFocusDate)) { |
1015 | 1022 | if (!isIsoDateString(saveMaxNextFocusDate) || nextFocusDate > saveMaxNextFocusDate) { |
1016 | 1023 | saveMaxNextFocusDate = nextFocusDate; |
1017 | 1024 | } |
|
1781 | 1788 | append = false, |
1782 | 1789 | centerDateInView = "", |
1783 | 1790 | centerBehavior = "auto", |
| 1791 | + suppressPendingFocus = false, |
1784 | 1792 | } = {}) { |
1785 | 1793 | const requestVersion = ++loadRequestVersion; |
1786 | 1794 | const params = new URLSearchParams(); |
|
1852 | 1860 | if (isIsoDateString(payloadStart)) loadedStartDate = payloadStart; |
1853 | 1861 | if (isIsoDateString(payloadEnd)) loadedEndDate = payloadEnd; |
1854 | 1862 | } |
1855 | | - applyPendingFocus(); |
| 1863 | + if (!suppressPendingFocus) { |
| 1864 | + applyPendingFocus(); |
| 1865 | + } |
1856 | 1866 | const centerTarget = String(centerDateInView || "").trim(); |
1857 | 1867 | if (isIsoDateString(centerTarget)) { |
1858 | 1868 | requestAnimationFrame(() => { |
|
0 commit comments