-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: move non-shared code from frontend-shared to app #24674
Conversation
highlightIndexes: number[] | ||
} | ||
|
||
export function buildSpecTree<T extends FoundSpec> (specs: FoundSpec[], root: SpecTreeNode<T> = { name: '', isLeaf: false, children: [], id: '', highlightIndexes: [] }): SpecTreeNode<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spec-utils
ended up a dumping ground for random things - many of these functions have one very specific purpose, which is to build the spec tree (not just utils) so I moved them to a more accurately named file.
@@ -0,0 +1,266 @@ | |||
import type { ComputedRef, Ref } from 'vue' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from frontend-shared, no changes. This is not a shared file, it is only used in App.
@@ -12,16 +12,12 @@ export const useSpecStore = defineStore({ | |||
state (): SpecState { | |||
return { | |||
activeSpec: undefined, | |||
specFilter: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused? I think a hold-over from before we used GraphQL and preferences to save the spec filter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we don't seem to be reading it anywhere 👍
@@ -25,7 +25,6 @@ export function useSpecFilter (savedFilter?: string) { | |||
|
|||
function setSpecFilter (specFilter: string) { | |||
if (specStore.specFilter !== specFilter) { | |||
specStore.setSpecFilter(specFilter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused, this was not doing anything but saving the specFilter in the store for no reason.
Test summaryRun details
View run in Cypress Dashboard ➡️ FlakinessThis comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
import RowDirectory from './RowDirectory.vue' | ||
import SpecItem from './SpecItem.vue' | ||
import { useVirtualList } from '@packages/frontend-shared/src/composables/useVirtualList' | ||
import { useVirtualList } from './tree/useVirtualList' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this has been backported to VueUse, do we want to try using the VueUse implementation: https://vueuse.org/core/usevirtuallist/#usevirtuallist
I wonder if we have diverged or if this will just work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, we should do this. Not right here, though -- I don't want to introduce any risk or change to code in this PR where possible - this is a quick reshuffling of things.
Nice to clean some of this up! I have no problems with this move, though I had been thinking in an almost opposite way - that possibly more things should begin their life in This wouldn't happen if we saw the Not blocking though, just something I meant to bring up. Is this ready for review? It's still in draft. |
Why was it painful? I wasn't involved in this, but it should be as simple as moving and updating some imports. If it's not, our code is coupled to our build infrastructure - which means we should fix that. In this PR, I just did a bunch of dragging around VS Code and a few find and replaces.
I do kind of agree with this. I think generic components are fine to include in That said, the opposite end of argument would be "don't over abstract; refactor and make generic if you need it. I don't feel too strongly about this either way, the main reason I made this PR is I think it'll make reviewing the upcoming Run All Specs changes a little easier, since we are probably touching that area quite a bit.
Moved to review! |
Just adding my .02. I'm all for YAGNI, and keeping things as minimal as possible. However, I would suggest that we commit to starting the life of a component in frontend-shared. In addition to Mark's viewpoints, it also makes it much easier for a developer to discover an implementation if something already exists. We should be careful to not over generalize a component just because it lives here, though. Let the re-usablity be implemented as needed. |
Happy to approve, especially as a broken-out part of other work that makes reviews easier 👏
Moving the components was OK, the challenges were mostly around graphql data that the components we moved needed to access. Moving/renaming components meant updating a lot of GQL intercepts, for example, since the naming convent for fragments is tied to the component structure, and a few other things. We can chat more about it some time. Probably ties more into our test infra than the actual location of our files. @rockindahizzy I'd be fine with "new components are created in frontend-shared by default" and not moving the old stuff right away. We can update the frontend-shared README to guide people to do this, and discuss whether the team agrees in that PR. |
While working on the Spec List code for #24467 with @amehta265, we found it confusing that a lot of functionality was split across
frontend-shared
andapp
. Turns out a lot of what was infrontend-shared
isn't shared - it's exclusively consumed inapp
. For this reason, I decided to move theapp
only code intoapp
. This makes it much easier to follow the code around.There are no functionality changes here, I just deleted some unused code and moved some from around.