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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user