1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-04 04:42:05 -04:00

(notepad): Update tab loading with request ID validation

This commit is contained in:
purian23
2026-03-18 00:10:35 -04:00
parent fbe8cbb23f
commit 8e047f45f5
2 changed files with 28 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ Column {
property string previewMode: "split" // split | full
property string pluginHighlightedHtml: ""
property string lastPluginContent: ""
property int loadRequestId: 0
signal saveRequested()
signal openRequested()
@@ -54,10 +55,18 @@ Column {
function loadCurrentTabContent() {
if (!currentTab) return
const requestedTabId = currentTab.id
const requestId = ++loadRequestId
contentLoaded = false
NotepadStorageService.loadTabContent(
NotepadStorageService.currentTabIndex,
(content) => {
const activeTab = NotepadStorageService.tabs.length > NotepadStorageService.currentTabIndex
? NotepadStorageService.tabs[NotepadStorageService.currentTabIndex]
: null
if (requestId !== loadRequestId || !activeTab || activeTab.id !== requestedTabId)
return
lastSavedContent = content
textArea.text = content
contentLoaded = true