figma-console-mcp 1.6.2 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -891,13 +891,37 @@ figma.ui.onmessage = async (msg) => {
|
|
|
891
891
|
// Load all pages first (required before accessing children)
|
|
892
892
|
console.log('🌉 [Desktop Bridge] Loading all pages...');
|
|
893
893
|
await figma.loadAllPagesAsync();
|
|
894
|
-
console.log('🌉 [Desktop Bridge] All pages loaded, searching for components...');
|
|
895
894
|
|
|
896
|
-
//
|
|
895
|
+
// Process pages in batches with event loop yields to prevent UI freeze
|
|
896
|
+
// This is critical for large design systems that could otherwise crash
|
|
897
897
|
var pages = figma.root.children;
|
|
898
|
-
pages
|
|
899
|
-
|
|
900
|
-
|
|
898
|
+
var PAGE_BATCH_SIZE = 3; // Process 3 pages at a time
|
|
899
|
+
var totalPages = pages.length;
|
|
900
|
+
|
|
901
|
+
console.log('🌉 [Desktop Bridge] Processing ' + totalPages + ' pages in batches of ' + PAGE_BATCH_SIZE + '...');
|
|
902
|
+
|
|
903
|
+
for (var pageIndex = 0; pageIndex < totalPages; pageIndex += PAGE_BATCH_SIZE) {
|
|
904
|
+
var batchEnd = Math.min(pageIndex + PAGE_BATCH_SIZE, totalPages);
|
|
905
|
+
var batchPages = [];
|
|
906
|
+
for (var j = pageIndex; j < batchEnd; j++) {
|
|
907
|
+
batchPages.push(pages[j]);
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
// Process this batch of pages
|
|
911
|
+
batchPages.forEach(function(page) {
|
|
912
|
+
findComponents(page);
|
|
913
|
+
});
|
|
914
|
+
|
|
915
|
+
// Log progress for large files
|
|
916
|
+
if (totalPages > PAGE_BATCH_SIZE) {
|
|
917
|
+
console.log('🌉 [Desktop Bridge] Processed pages ' + (pageIndex + 1) + '-' + batchEnd + ' of ' + totalPages + ' (found ' + components.length + ' components so far)');
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
// Yield to event loop between batches to prevent UI freeze and allow cancellation
|
|
921
|
+
if (batchEnd < totalPages) {
|
|
922
|
+
await new Promise(function(resolve) { setTimeout(resolve, 0); });
|
|
923
|
+
}
|
|
924
|
+
}
|
|
901
925
|
|
|
902
926
|
console.log('🌉 [Desktop Bridge] Found ' + components.length + ' components and ' + componentSets.length + ' component sets');
|
|
903
927
|
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
};
|
|
224
224
|
|
|
225
225
|
window.refreshVariables = () => {
|
|
226
|
-
return window.sendPluginCommand('REFRESH_VARIABLES', {})
|
|
226
|
+
return window.sendPluginCommand('REFRESH_VARIABLES', {}, 300000)
|
|
227
227
|
.catch(function(err) { return { success: false, error: err.message || String(err) }; });
|
|
228
228
|
};
|
|
229
229
|
|
package/package.json
CHANGED