# Code duplication when accidentally switching to main.blocks during custom extension development in MakeCode

**URL:** https://forum.makecode.com/t/code-duplication-when-accidentally-switching-to-main-blocks-during-custom-extension-development-in-makecode/30457
**Category:** micro:bit
**Created:** [September 6, 2024, 6:12pm UTC](https://forum.makecode.com/t/code-duplication-when-accidentally-switching-to-main-blocks-during-custom-extension-development-in-makecode/30457 "2024-09-06T18:12:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mpoelzl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mpoelzl/32/17062_2.png) [@mpoelzl](https://forum.makecode.com/u/mpoelzl)
#### Post date: [September 6, 2024, 6:12pm UTC](https://forum.makecode.com/t/code-duplication-when-accidentally-switching-to-main-blocks-during-custom-extension-development-in-makecode/30457/1 "2024-09-06T18:12:09Z")

</div>

Hello!

There is an “annoying” behaviour in the Makecode editor when developing a custom extension. If I accidentally click on the main.blocks file (or select Blocks at the top) the custom extension code gets converted into one large block.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/7/7/774180fb176715b0c5cd56c6724a5d532ad56c34.png)

Switching back to JavaScript now shows that all the variables have been appended with a number 2 in this process:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/4/5/4506249e6a3a3f4719ade226eef5ee4f7271577b.png)

It’s not really much of an issue if reverted straight away but I’ve managed to miss it and made other changes and then the commit looks really messy.

So my question is, are there any adverse effects if I just delete main.blocks file in the extension to prevent this?  
Thanks!

---

<div class="post-metadata">

### Author: ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)
#### Post date: [September 6, 2024, 6:12pm UTC](https://forum.makecode.com/t/code-duplication-when-accidentally-switching-to-main-blocks-during-custom-extension-development-in-makecode/30457/2 "2024-09-06T18:12:48Z")

</div>

@mpoelzl no adverse effects! in fact, I recommend doing that for any TS only project (extensions included)

---

<div class="post-metadata">

### Author: ![mpoelzl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mpoelzl/32/17062_2.png) [@mpoelzl](https://forum.makecode.com/u/mpoelzl)
#### Post date: [September 6, 2024, 9:07pm UTC](https://forum.makecode.com/t/code-duplication-when-accidentally-switching-to-main-blocks-during-custom-extension-development-in-makecode/30457/3 "2024-09-06T21:07:55Z")

</div>

Thank you!
