Nb202b Cannot paste >5 blocks from Backpack

Dear All,
I want to copy-paste from one project to another. Copying works fine from project1 and if I re-open the backpack in project1, I can still see the content. When I go to project2, trying to open the Backpack,

  • if there are 5 or less blocks in the Backpack: It opens, I can paste
  • if there are more than 5 items but less than ~55, the paste does not work, but a grey vertical bar appears on the right of the screen (it must be the background o Backpack), but I see no blocks (see screnshot)
  • If there are more blocks than ~50-55, I see nothing appearing if I open the Backpack (seemingly it does nothing).

If I go back to project1, the Backpack opens and I see the contents that I copied into.

  1. Obviously I tried to empty the Backpack and add the content again, then I emptied the Backpack then closed the browser then restarted, I tried to empty the Backpack and refresh the page, with no success
  2. I tried Classic and Neo user interfaces, too
  3. I tried to paste to different, even to empty projects
  4. I tried to completely clear the browser cache between restarts (history, cookies, stored data etc.)

I experienced the same behavior always.

Normally I use Firefox (now it's 144.0) and I tried it with Google Chrome (v141.0.7390.108). It behaves exactly the same way in both.

I don't use Backpack that much so I can't recall when it worked last time. I've read that there was a similar issue ~6 months ago, but now the App Inventor version is different and I would like to make sure if it's a recurring problem. The solutions that were proposed to the older bug, are not working for me.

Could you please suggest what I can do (instead of copying 500 blocks in 5 blocks steps, haha).

Thank you!

Get the AI2Helper browser extension and use it to generate draggable block image files on your computer storage.

Drag those in.

When you have too many blocks spread out over too large a surface area,
the Blocks Editor hits a complexity limit when it tries to generate a blocks.png file for the screen.

There are two main approaches to deal with this:

  • Start a Google Doc with a Table of Contents explaining your app, with sections for Design, Data, Code, including Downloaded Png images of all Events, Procedures, Globals, and with html cross-links for easy navigation. Such a doc becomes easier to read than a complete blocks image, because you have FIND, Next, PREV, back functionality, and you can add paragraphs of commentary around your code. This is my preferred life saver when doing a very large complex app. If you go this route, try to arrange your blocks geographically in a column matching the order of your Table of Contents, then do periodic Clean Up Blocks to pull them inline. This sometimes lowers the load on the Blocks Editor.
  • Reduce your block count:
    • Use parametrized procedures for common code
    • Use Media text files instead of big clumps of text blocks
    • Use generic blocks instead of repeating component event blocks
    • Encode repeating decision patterns into lookup tables loaded from Media csv text files (does your blocks image look like a box of combs?)
    • You don't need a component for every data instance. Reuse those components.
    • If you can't fit data into a ListView or List Picker, show a small subset of the data in an Arrangement and slide it across the larger list of data.

Thank you for the reply. I'm not sure how many is "too many" and what is "too large" area in your view but this is not the first time when I bumped to an issue because of "too many" blocks; it happened last year that it could not compile because of that, and I did lots of optimizations then. I confess my project still has 8231 blocks (only ~70 visible, as they are eiher functions or events, collapsed) but I've already done with your suggested actions. Seriously.

I can see only one possible way to further reduce the size. The GUI contains lots of labels to show data and quite a few fields, selectors, switches etc. as it is intended to exhange data and settings with a microcontroller project. Those have validations and code to change them. I can create a Webview and implement the GUI as a responsive HTML page, but honestly I'm afraid how stable and fast the data exchange will be (I only have WebviewString that is not designed to exchange lots of data and fast) and I don't know what rendering issues I would have to face with. Currently it works very good but I have to implement new features. Everything else I converted already to HTML so at the end of the day, my app will be only a shell for HTML pages. :frowning:

Note that until today no one could tell me what are the limits in App Inventor 2, but it seems to be around 8000 blocks; and how many seen on the screen seems to be irrelevant.

AI2 has generic blocks, and can help to map components into JSON tags.

There are blocks that return all components of a given type, useful in combination with the Is In List block to determine the component type of a component.

There is also YAML output, a more generalized way to show detailed data:

Consider generalizing the code to a schema based setup.