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

[Vue] Migrate content-block, enriched-headline, rate-feature + related #18166

Merged
merged 27 commits into from Oct 26, 2021

Conversation

diosmosis
Copy link
Member

@diosmosis diosmosis commented Oct 17, 2021

Description:

Changes:

  • add static AjaxHelper.fetch method to make it seem more like piwikApi service
  • migrate RateFeature component
  • modify MatomoDialog to use v-model so it's simpler to use from vue
  • made vue: property optional in scope mapping in createAngularAdapter
  • migrate enrichedheadline
  • allow translate function to take variadic args OR array of strings like _pk_translate
  • migrate contentblock component
  • (not related to vue) fix anchor links in trackingcodegenerator page (linking to #anchor instead of #/anchor causes angularjs to fail, happens on 4.x-dev too)
  • fix nested transclude issue w/ createAngularAdapter

Notes:

image

image

image

Note: it seems adding components does bump the the JS payload a bit. The 4 new vue component templates add about 2kb to the gzipped content. It might be good to set a threshold for when it would be good to explore either using async components or loading plugin UMD's lazily. Both are doable, but it would be easier to manage the latter option in the long run.

Review

@diosmosis diosmosis added this to the 4.6.0 milestone Oct 17, 2021
@diosmosis diosmosis marked this pull request as draft October 17, 2021 06:30
@diosmosis diosmosis added the Needs Review PRs that need a code review label Oct 17, 2021
@diosmosis diosmosis marked this pull request as ready for review October 17, 2021 18:51
adminContent = document.querySelector('#content.admin');
}

let contentTopPosition: number;
Copy link
Member

Choose a reason for hiding this comment

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

I'm actually not familiar with how this is interpreted. Will contentTopPosition be initialized with null here or with 0 as it's a number?

Copy link
Member Author

@diosmosis diosmosis Oct 22, 2021

Choose a reason for hiding this comment

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

It should be initialized as undefined.

Copy link
Member Author

Choose a reason for hiding this comment

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

Though it seems sometimes typescript complains about this, sometimes not...

Copy link
Member

Choose a reason for hiding this comment

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

The reason for the question actually was to clarify if the default value would pass the condition below:
contentTopPosition || contentTopPosition === 0.
Before it was initialized with false. Guess undefined should work correctly as well then.

Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

Left some more comments. Besides that, the code already looks fine. Will do some cross browser testing next week and hopefully travis tests will then run again, so we can see if all tests are passing or not.

Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

Seems to work as expected. Once we have tests running again and they pass this would be good to merge.

@sgiehl
Copy link
Member

sgiehl commented Oct 25, 2021

@diosmosis Unrelated to this PR, I get the following notice in the browser console

Source-Map-Fehler: Error: NetworkError when attempting to fetch resource.
Ressourcen-Adresse: webpack:////home/dizzy/Projects/matomo/node_modules/dompurify/dist/purify.js?

Seems the path is your local one...

@diosmosis
Copy link
Member Author

@sgiehl I grepped for it and its in the source map for the polyfill build... not sure why it's using absolute paths, the build config might be wrong there... I'll take a look, thanks for mentioning it!

@diosmosis
Copy link
Member Author

@sgiehl should be fixed

@diosmosis
Copy link
Member Author

Actually it seems the recommended approach is to not include the sourcemap in production: https://webpack.js.org/configuration/devtool/, but since we distribute unminified javascript with plugins (and much of Matomo is open source), perhaps this isn't something we need to care about... cc @sgiehl @tsteur

@diosmosis
Copy link
Member Author

Actually, actually, since we just merge everything into one big JavaScript asset, the sourcemaps are useless in production.

@diosmosis
Copy link
Member Author

@sgiehl some test failures but they don't seem related

@sgiehl
Copy link
Member

sgiehl commented Oct 26, 2021

Actually, actually, since we just merge everything into one big JavaScript asset, the sourcemaps are useless in production.

Should we remove them from the build then, so they aren't included in the release zip?

@sgiehl
Copy link
Member

sgiehl commented Oct 26, 2021

Tests seem to pass. Will merge this now.

@sgiehl sgiehl merged commit 1023fb7 into 4.x-dev Oct 26, 2021
@sgiehl sgiehl deleted the vue-content-block branch October 26, 2021 12:00
@diosmosis
Copy link
Member Author

@sgiehl

Should we remove them from the build then, so they aren't included in the release zip?

I guess we could, they're only really useful for development, and they'll be generated when we develop. I'll make a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants