surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.2k stars 812 forks source link

Ranking: Enhance performance with many items #8108

Closed mikeamelin closed 6 months ago

mikeamelin commented 7 months ago

~ 200 items. Drag-n-drop is too slow.

https://github.com/surveyjs/survey-library/assets/17025812/1f0c1223-d8de-4aa4-aec5-d8069776c0de

mikeamelin commented 6 months ago

Looks like the issue is still here.

tsv2013 commented 6 months ago

The issue is in survey-knockoutui only - in drag drop helper:

  protected afterDragOver(dropTargetNode: HTMLElement): void {
    const choices = this.parentElement.rankingChoices;
    const dropTargetIndex = choices.indexOf(this.dropTarget);
    const draggedElementIndex = choices.indexOf(this.draggedElement);

    choices.splice(draggedElementIndex, 1);
    choices.splice(dropTargetIndex, 0, this.draggedElement);
    this.parentElement.setPropertyValue("rankingChoices", choices); // <- Here we assign all the question that triggers whole list re-rendering in KO

We decided not to fis it and use react version on our site. Probably get rid of KO support in v2.0 and use react+preact instead.