Open aznhassan opened 4 years ago
A place to start would be the createCategories
function in toolboxeditor.tsx
. Looking at the following line in particular:
if ((md.subcategories && md.subcategories.length) || that.subcategoryMap[ns]) {
subcategories = createSubCategories([ns, md], md.subcategories || Object.keys(that.subcategoryMap[ns]), isAdvanced);
}
we can see that we use the list of subcategories associated with each namespace or the subcategoryMap. When the makerbit-lcd1602 extension is installed, the makerbit
Symbolnfo does not have a subcategories
field, but the subcategory map contains both the LCD1602 and LCD2004 subcategories for the makerbit
entry.
Later when we install the makerbit extension, the makerbit
SymbolInfo will be updated to have a subcategories
field. That field will not contain LCD2004. It is interesting to note that at this point, the subcategoryMap will actually contain the LCD2004 subcategory along with all the others present in the subcategory list on the makerbit
SymbolInfo. There is a disconnect between the subcategoryMap the list of subcategories in the SymbolInfo of a namespace.
Now it seems that just loading the makerbit-lcd1602 extension, which has both 1602 and 2004, does not show MakerBit at all in the main category list, and when looking at the javascript view, only 1602 shows up, but not 2004.
https://makecode.microbit.org/_4UDXKjXegEvt
This may be related to issue https://github.com/microsoft/pxt/pull/7562, but in this case we're not loading a second extension (are we?).
And, it's also now the case that just trying to add the complete makerbit extension package, adds all the subcategories as can be seen in the javascript view, but MakerBit does not appear in the main category list at all.
This happens with both the browser editor, and the MakeCode for microbit.app for Mac, v3.0.65.
It may still be related to this issue: https://github.com/microsoft/pxt-microbit/issues/3332 (?)
Problem
Loading an extension and then loading a second extension that contains the first can lead to missing subcategories.
Repro Steps
MakerBit
category in the toolbox withLCD1602
andLCD2004
subcategories under it.LCD2004
category is gone while theLCD1602
category remains.If you look for
2004
in the toolbox search bar, you'll still be able to find theLCD2004
blocks.Expected Behavior
The expected behavior is that the
LCD2004
subcategory should not disappear.Note
The problem probably lies with how namespaces for extensions are defined.
After Loading Just the makerbit-lcd1602 extension
After loading the makerbit extension as well
Searching for the LCD2004 blocks
Desktop:
Additional context
Refer to #7562 for additional context.