pibakery icon indicating copy to clipboard operation
pibakery copied to clipboard

Custom block added multiple times

Open dsbert opened this issue 9 years ago • 1 comments
trafficstars

This concerns adding a custom block by dragging the folder into the application window.

The user is allowed to drag the same block multiple times. Each time the block is dropped onto the window, a duplicate is added to the block selection menu. If the block is modified, all of the duplicates appear to update.

I've also noticed that an error is output in the console when dragging a block. It appears the duplicate block check should happen here, but the error is printed instead.

pibakery.js:2397 Error: ENOENT: no such file or directory, stat '/projects/raspberrypi/pibakery/source/pibakery-blocks/mountnfs'(…)(anonymous function) @ pibakery.js:2397
            if (error) {
              console.error(error)
            }
            else {
              var choice = dialog.showMessageBox(
                {
                  type: 'question',
                  buttons: ['Yes', 'No'],
                  title: 'Block Conflict',
                  message: 'The block you are trying to import conflicts with a block already imported into PiBakery. Do you want to overwrite the existing block?'
                })

dsbert avatar Sep 25 '16 00:09 dsbert

That bit of code is actually there to prevent import conflicts between blocks that you drag in, and blocks that are already in PiBakery from the pibakery-blocks folder, which is why that error is allowed to pass (it's good if it passes).

Currently there's no checking if a dragged-in block already exists, but I'm guessing the best behaviour would be to delete that block, and import the new one, which would effectively update the existing one?

davidferguson avatar Sep 26 '16 00:09 davidferguson