Skip to content

Commit

Permalink
Hot fix for materials explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
kmdouglass committed Feb 7, 2025
1 parent 63af754 commit ef05a0b
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions www/js/src/components/explorers/MaterialsExplorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ const MaterialsExplorer = ( {materialsService, isLoadingFullData } ) => {

const selectedMaterials = useSyncExternalStore(
// Subscribe callback - must return an unsubscribe function
(onStoreChange) => {
const observer = new MutationObserver(onStoreChange);

// Return unsubscribe function
return () => observer.disconnect();
},
// GetSnapshot callback - return current value
(onStoreChange) => materialsService.subscribe(onStoreChange),
() => materialsService.selectedMaterials
);

Expand Down Expand Up @@ -118,9 +112,6 @@ const MaterialsExplorer = ( {materialsService, isLoadingFullData } ) => {
if (selectedMaterials.has(key)) return;

await materialsService.addMaterialToSelectedMaterials(key);

const newMaterials = new Map(materialsService.selectedMaterials);
setSelectedMaterials(newMaterials);
}

const handleRemoveMaterial = () => {
Expand All @@ -129,7 +120,6 @@ const MaterialsExplorer = ( {materialsService, isLoadingFullData } ) => {
const newMaterials = new Map(selectedMaterials);
selectedListItems.forEach(key => newMaterials.delete(key));

setSelectedMaterials(newMaterials);
materialsService.selectedMaterials = newMaterials;

setSelectedListItems([]);
Expand Down

0 comments on commit ef05a0b

Please sign in to comment.