Uploaded image for project: 'ZK Spreadsheet'
  1. ZK Spreadsheet
  2. ZSS-1115

Encounter "Warning: Unresponsive script" in Firefox when setting massive cells

XMLWordPrintable

    • Sprint 2

      Problem description

      A user encounter the "unresponsive script error" with Firefox:

      • they are seeing a problem when trying to render/update cells after we populate the data to a sheet.
      • they are using a process queue on the server side and then when the data is sent back to the client, the show busy spinner pauses, and then before all the cells can update, we get the browser's unresponsive script error. If you continue, you get a few more cells updated.
      • This particular book has 1 sheet tab with 600 cells that need to be updated when the server sends back the data.
      • This took about 5 secs to get the data and render it to the page when using ZSS 2.6.

      Steps to reproduce

      1. run attached files and visit it with Firefox
      2. Click "populate data" button. It's implemented by the echo event. The "unresponsive script warning" should appear.
      3. Click "populate data - event queue" button. The warning should not appear.

      Debug information

      • When unresponsive script warning shows, the response size is relative larger than normal e.g. 2000 cells, 9506k, response array size: 8000
      • call notifyChange() doesn't eliminate the issue
        @Listen("onPopulate= #ss")
        public void populate(Event e) throws InterruptedException{
            populateData();
            Clients.clearBusy();
            Ranges.range(ss.getSelectedSheet()).notifyChange(); // add this line doesn't eliminate the issue nor reduce the response size
        }
        

      Workaround

      Perform a heavy operation in an event queue

      queue.subscribe(new EventListener<Event>() {
      			
      			@Override
      			public void onEvent(Event e) throws Exception {
      					performHeavyOperation();
      			}
      		}, new EventListener<Event>() {
      			@Override
      			public void onEvent(Event e) throws Exception {
      				//access a spreadsheet component
      				Ranges.range(spreadsheet.getSelectedSheet()).notifyChange();
      				Clients.clearBusy();
      			}
      		});
      
              //an event listener to trigger the 
      	@Listen("onCellClick = #spreadsheet")
      	public void onCellClick(CellMouseEvent event){
      		queue.publish(new Event("onStart"));
      		Clients.showBusy("busy...");
      	}
      
      

        1. setMassiveCells.zul
          0.4 kB
          hawk
        2. SetMassiveCellsComposer.java
          2 kB
          hawk
        3. ZKInsertMerge.java
          4 kB
          hawk
        4. zkinsertmerge.xlsx
          366 kB
          hawk
        5. zkinsertmerge.zul
          0.2 kB
          hawk

            henrichen henrichen
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: