mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 06:38:03 +08:00
Improve message ordering to use a stack (#707)
* Improve message ordering * Resovle bug with widgets * Less code duplication for UpdateOpenDocumentsList * Fix layer panel
This commit is contained in:
committed by
Keavon Chambers
parent
d12d805e2f
commit
b2eae904d8
@@ -85,20 +85,7 @@ impl PortfolioMessageHandler {
|
||||
|
||||
self.documents.insert(document_id, new_document);
|
||||
|
||||
// Send the new list of document tab names
|
||||
let open_documents = self
|
||||
.document_ids
|
||||
.iter()
|
||||
.filter_map(|id| {
|
||||
self.documents.get(id).map(|document| FrontendDocumentDetails {
|
||||
is_saved: document.is_saved(),
|
||||
id: *id,
|
||||
name: document.name.clone(),
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
responses.push_back(FrontendMessage::UpdateOpenDocumentsList { open_documents }.into());
|
||||
responses.push_back(PortfolioMessage::UpdateOpenDocumentsList.into());
|
||||
|
||||
responses.push_back(PortfolioMessage::SelectDocument { document_id }.into());
|
||||
}
|
||||
@@ -209,19 +196,7 @@ impl MessageHandler<PortfolioMessage, &InputPreprocessorMessageHandler> for Port
|
||||
};
|
||||
|
||||
// Send the new list of document tab names
|
||||
let open_documents = self
|
||||
.document_ids
|
||||
.iter()
|
||||
.filter_map(|id| {
|
||||
self.documents.get(id).map(|doc| FrontendDocumentDetails {
|
||||
is_saved: doc.is_saved(),
|
||||
id: *id,
|
||||
name: doc.name.clone(),
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
responses.push_back(FrontendMessage::UpdateOpenDocumentsList { open_documents }.into());
|
||||
responses.push_back(UpdateOpenDocumentsList.into());
|
||||
responses.push_back(FrontendMessage::UpdateActiveDocument { document_id: self.active_document_id }.into());
|
||||
responses.push_back(FrontendMessage::TriggerIndexedDbRemoveDocument { document_id }.into());
|
||||
responses.push_back(RenderDocument.into());
|
||||
|
||||
Reference in New Issue
Block a user