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
fix: prepend router.base
when sending page track events
#20
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20 +/- ##
==========================================
- Coverage 94.44% 89.18% -5.26%
==========================================
Files 2 2
Lines 36 37 +1
Branches 10 10
==========================================
- Hits 34 33 -1
- Misses 2 4 +2
Continue to review full report at Codecov.
|
lib/plugin.js
Outdated
@@ -1,5 +1,7 @@ | |||
const _layer = '<%= options.layer %>' | |||
const _id = '<%= options.id %>' | |||
// Remove trailing slash to avoid duplicate slashes when appending route path | |||
const _routerBase = '<%= options.routerBase.replace(/\/+$/, '') %>' |
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.
Should we consider trailingSlash here? (also generating final URL)
Also, I think we can simply do normalization from module. (probably line before return)
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.
As we discussed online, the trailingSlash
option should not affect this logic.
There is a small issue with trailingSlash
option that is unrelated to this PR though. I'll create an issue for it. Edit: #21
- include router's base in `pageUrl` property of triggered page tracking events - replace head function in example nuxt.config.js with a plain object as that has triggered a noisy warning and wasn't tested anyway - add @types/jest to provide completions for test functions (when using relevant language server).
@rchl Would you please check failing test? |
@pi0 All tests have passed by looking at the test output. It seems to be an issue with Nuxt blocking the event loop sometimes. Could you try re-running workflow? It might just pass next time. |
router.base
when sending page track events
pageUrl
property of triggered page tracking eventsas that has triggered a noisy warning and wasn't tested anyway
relevant language server).