GithubHelp home page GithubHelp logo

Comments (3)

Xerillio avatar Xerillio commented on August 11, 2024

@cribeiro84 I've been trying without success to figure out how this.state.pullRequests and this.pullRequestItemProvider are connected and what the purpose of each is. I'm guessing one is for rendering/sub-component props and the other is the underlying list (i.e. cached data source). Do you remember if there's a reason it's not all being maintained in one list in the component's state?

The following is a dirty fix for this issue, but I think I'd need a better understanding of this.state.pullRequests vs. this.pullRequestItemProvider to come up with something better.

    const sortingBehavior = new ColumnSorting<
      PullRequestModel.PullRequestModel
    >((columnIndex: number, proposedSortOrder: SortOrder) => {
      this.pullRequestItemProvider.splice(
        0,
        this.pullRequestItemProvider.length,
        ...sortItems<PullRequestModel.PullRequestModel>(
          columnIndex,
          proposedSortOrder,
          this.sortFunctions,
          this.columns,
-         pullRequests
+         this.pullRequestItemProvider.value as PullRequestModel.PullRequestModel[]
        )
      );
      this.setState({ sortOrder: proposedSortOrder });
    });

Link to the first line in the snippet

from azure-devops-pull-request-hub.

cribeiro84 avatar cribeiro84 commented on August 11, 2024

@Xerillio thanks for brining this up! I will be honest with you, the code itself is not the best one I could develop because it was my first time writing an ADO extension and a React App :-P

My main goal of this project would be to re-write it from scratch removing all the workarounds I had to do but I am struggling to find free time to do it (my little son loves to play till late night).

Answering your question, the this.state.pullRequests is all the PRs that were fetched, it's "cached" and the filtered on the fly because most of the APIs provided by ADO does not have filters and also to avoid chatty API calls to the server. If I am not mistaken, the pullRequestItemProvider is related to the applied filters.

from azure-devops-pull-request-hub.

Xerillio avatar Xerillio commented on August 11, 2024

@cribeiro84 Completely understandable 😊 ADO extensions are also completely new to me and only limited experience with React. I'll try to give it a go restructuring it by keeping the cached list separate from the Reach component (PullRequestsTab) so the component only maintains the shown/filtered list. If I succeed, I'll submit a PR.

Happy new year!

from azure-devops-pull-request-hub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.