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

Add lazy loading to md image #337

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

nicolaskempf57
Copy link
Contributor

Closes datagouv/data.gouv.fr#1188

This PR also introduces a unified <markdown-viewer>.

Copy link
Contributor

@maudetes maudetes left a comment

Choose a reason for hiding this comment

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

I could not make it work locally, markdown-viewer does not seem to get mounted.

The issue I see with this approach is that before vue app can be loaded (can take up some time), description will be empty. I think it may degrade user experience?

@@ -103,8 +103,9 @@ <h1 class="fr-mb-5v fr-h3">
</h1>
<h2 id="description" class="subtitle fr-mb-1w">{{ _('Description') }}</h2>
<read-more max-height="description" class="fr-mb-n1w">
{{ dataset.description|markdown }}
<markdown-viewer data-content="{{dataset.description|to_json}}"></markdown-viewer>
Copy link
Contributor

Choose a reason for hiding this comment

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

If we keep this idea, we should apply the same logic for other markdown contents? In particular, I'm thinking of pages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is indeed the idea to have a unified viewer for all contents. This could allow us to use DSFR tables everywhere for example instead of our custom ones.

@nicolaskempf57
Copy link
Contributor Author

I could not make it work locally, markdown-viewer does not seem to get mounted.

I'll look into it.

The issue I see with this approach is that before vue app can be loaded (can take up some time), description will be empty. I think it may degrade user experience?

Vue loading shouldn't be longer here than on other pages but I agree that nothing was done currently regarding performance and we should start working on it or at least planning some work like Sentry Performance Monitoring.

@maudetes
Copy link
Contributor

maudetes commented Jan 4, 2024

I could not make it work locally, markdown-viewer does not seem to get mounted.

I'll look into it.

My bad, I had not build the correct udata-front assets. After rebuilding, it works correctly!

@nicolaskempf57
Copy link
Contributor Author

This PR will be replaced due to datagouv/data.gouv.fr#1194

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.

Forcer le lazy loading des images des descriptions markdown d'udata-front
2 participants