microsoft / pxt-microbit

A Blocks / JavaScript code editor for the micro:bit built on Microsoft MakeCode
https://makecode.microbit.org
Other
726 stars 638 forks source link

Some extension "Learn more" snippet Edit buttons don't work #4832

Closed martinwork closed 1 year ago

martinwork commented 2 years ago

Describe the bug

The Edit buttons on some extensions' Learn more pages, fail to create a working project.

There's a dialogue offering to fix the problem, which doesn't work. The JavaScript mode Explorer shows multiple errors

The errors are often due to duplication of the extension with different package names. Once this has happened, adding the extension to the original project fails: it appears in the Explorer, but not on the blocks categories panel. This seems to be quite persistent. I ended up resetting MakeCode and using F12/Application/Storage/Clear site data.

Example extensions: kitronik-servo-lite, iot-environment kit, Environment-and-Science-IoT, bluetooth-max6675

NB: USE AN INCOGNITO WINDOW TO TEST THIS. Close all incognito windows for a fresh start. The error occurs in normal windows, but I'm not sure it's recoverable without resetting MakeCode.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://makecode.microbit.org/
  2. Create a new project
  3. Open the extensions dialogue
  4. Click an extension's Learn more button
  5. Wait for the blocks to load
  6. Click an Edit button

Expected behavior A valid project is created.

micro:bit version (please complete the following information):

You can find this information in the lower right hand corner of the back of micro:bit (the side that says BBC micro:bit).

Desktop (please complete the following information):

abchatra commented 1 year ago

I can reproduce this.

kimprice commented 1 year ago

The duplication of the extensions is happening because the extensions repo's READMEs include a package list which includes the extension itself or a duplicate with a different package name. When we parse the README, we import all the packages that are listed, hence the duplication. I will file bugs on those repos.

martinwork commented 1 year ago

Arising from https://support.microbit.org/helpdesk/tickets/63962 (private)

@kimprice @abchatra

Although snippets in the Learn more page display blocks properly with the package list removed, it does not work when the README is viewed from MakeCode's Javascript Explorer.

Based on other examples, I think the README snippets display properly when the package list includes the extension's repo.

Could the self-reference be filtered out in the Learn more case?

I don't know how this applies to tutorials or other documentation files inside or outside the extension repo.

See https://github.com/microsoft/pxt-bluetooth-max6675

Learn more image

README image