Skip to content
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

Y24-432 centralize vue component initialization #2058

Merged
merged 37 commits into from
Dec 2, 2024

Conversation

seenanair
Copy link
Contributor

@seenanair seenanair commented Nov 7, 2024

Closes #2033

Changes proposed in this pull request

  • Created a centralized file, vue_app.js, for initializing Vue components
  • Added a generic helper function to dynamically mount Vue components based on the presence of specific HTML elements and their associated data attributes.
  • Removed the existing index.js files for each Vue component, eliminating redundancy
  • Globally registered commonly used components (LbMainContent, LbPage, LbSidebar) to eliminate the need for importing them in each Vue file.

Additional Notes
There is potential to globally register other shared components. However, some of these components are currently registered with different names across the application. A major refactor would be needed to unify these, which we recommend handling in a separate story to avoid an overly complex PR.

Instructions for Reviewers

[All PRs] - Confirm PR template filled
[Feature Branches] - Review code
[Production Merges to main]
    - Check story numbers included
    - Check for debug code
    - Check version

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

Attention: Patch coverage is 94.05099% with 21 lines in your changes missing coverage. Please review.

Project coverage is 80.43%. Comparing base (a4e4a00) to head (4102bb0).
Report is 38 commits behind head on develop.

Files with missing lines Patch % Lines
app/frontend/javascript/vue_app.js 88.23% 16 Missing ⚠️
...ntend/javascript/file-list/components/FileList.vue 0.00% 3 Missing ⚠️
app/frontend/entrypoints/application.js 0.00% 1 Missing ⚠️
...xp-tube-panel/components/PoolXPTubeSubmitPanel.vue 87.50% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2058      +/-   ##
===========================================
+ Coverage    78.09%   80.43%   +2.34%     
===========================================
  Files          477      471       -6     
  Lines        18066    17932     -134     
  Branches       262      268       +6     
===========================================
+ Hits         14109    14424     +315     
+ Misses        3955     3506     -449     
  Partials         2        2              
Flag Coverage Δ
javascript 73.60% <94.01%> (+3.71%) ⬆️
pull_request 80.43% <94.05%> (+2.34%) ⬆️
push 80.43% <94.05%> (+2.34%) ⬆️
ruby 91.28% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@seenanair seenanair marked this pull request as draft November 7, 2024 14:37
Copy link
Contributor

@BenTopping BenTopping left a comment

Choose a reason for hiding this comment

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

Nice bit of refactoring 👌
Let me know if you want to go over the comments.

app/frontend/javascript/vue_app.js Outdated Show resolved Hide resolved
app/frontend/javascript/vue_app.js Outdated Show resolved Hide resolved
app/frontend/javascript/vue_app.js Outdated Show resolved Hide resolved
app/frontend/javascript/vue_app.js Outdated Show resolved Hide resolved
@seenanair seenanair marked this pull request as ready for review November 11, 2024 19:52
@seenanair seenanair requested a review from BenTopping November 12, 2024 10:16
Copy link
Contributor

@BenTopping BenTopping left a comment

Choose a reason for hiding this comment

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

Looks good, nice work!

I don't know how to test this manually but I am assuming you have and I reckon the int suite will cover most of the use cases.

app/frontend/javascript/vue_app.js Outdated Show resolved Hide resolved
@seenanair
Copy link
Contributor Author

seenanair commented Nov 12, 2024

Looks good, nice work!

I don't know how to test this manually but I am assuming you have and I reckon the int suite will cover most of the use cases.

That’s something I’m also a bit concerned about. I hope the integration suite covers most of it, and I’ll also ask the team if there are any better ways to test it.

Copy link
Contributor

@StephenHulme StephenHulme left a comment

Choose a reason for hiding this comment

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

That looks good - thanks for the improvements 🚀

@StephenHulme
Copy link
Contributor

Nice work, I like the direction this is taking @seenanair! I see you've found the eventBus too, hopefully we can eventually get rid of all the script tags 🤞

@seenanair
Copy link
Contributor Author

seenanair commented Nov 21, 2024

Nice work, I like the direction this is taking @seenanair! I see you've found the eventBus too, hopefully we can eventually get rid of all the script tags 🤞

Thanks @StephenHulme for the review. 🙏
The asset comment components were pretty tightly linked before, assuming all of them would always be on the same page in Limber. That worked fine for how things were currently set up in Limber, but I hope iit made sense to decouple them so they can be used independently if needed down the line. Plus, this way, we can avoid relying on data altogether.

This would be a great case for proper store management, but that felt like a big step right now. So, I just used the event bus since it was already there and working fine.

Copy link
Contributor

@BenTopping BenTopping left a comment

Choose a reason for hiding this comment

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

Nice, changes look sensible. Quite difficult to wrap my head around the store but I think it looks ok.

@seenanair seenanair merged commit 526ae79 into develop Dec 2, 2024
23 checks passed
@seenanair seenanair deleted the y24-432-centralize-vue-component-initialization branch December 2, 2024 16:16
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.

Y24-432 - Centralize Vue Component Initialization
3 participants