Skip to content

Move all sorting to the modeling store, and then all views preserve the sorting#3398

Merged
robertbrignull merged 3 commits intomainfrom
robertbrignull/sort-in-modeling-store
Feb 26, 2024
Merged

Move all sorting to the modeling store, and then all views preserve the sorting#3398
robertbrignull merged 3 commits intomainfrom
robertbrignull/sort-in-modeling-store

Conversation

@robertbrignull
Copy link
Copy Markdown
Contributor

This PR aims to make sorting of methods easier and prevent them from changing sort order and flying around when you make manual changes. Sorting of methods is moved to the modeling store so it happens in one place only, and then it is the job of each view to preserve the ordering of methods it is given.

This gives us a lot more control over what actions trigger a change in method sorting. As of this PR the only actions that should cause methods to change order are:

  • the initial loading of methods
  • saving modeled methods
  • new AI predictions

It also helps reduce some of the code bloat caused by #3382 because we no longer need to pass as much information to all the different views.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

@robertbrignull robertbrignull requested a review from a team as a code owner February 22, 2024 17:23
Copy link
Copy Markdown
Member

@koesie10 koesie10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but there seem to be a few failing tests dependent on the sorting

modifiedMethodSignatures: ReadonlySet<string>,
processedByAutoModelMethods: ReadonlySet<string>,
): Method[] {
function sortMethodsInGroups(methods: readonly Method[], mode: Mode): Method[] {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps name this something like createGroups or groupMethods since we're not actually sorting the methods?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't really call it groupMethods because that's also the name of the method in sorting.ts. I've renamed it to createGroups and we can always tweak again in the future if we want to.

@robertbrignull robertbrignull merged commit 6e61ddb into main Feb 26, 2024
@robertbrignull robertbrignull deleted the robertbrignull/sort-in-modeling-store branch February 26, 2024 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants