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

front: fix lazy loading for rolling stock images #9939

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

emersion
Copy link
Member

@emersion emersion commented Dec 4, 2024

We were unconditionally fetching the rolling stock image via getDocument(). Instead, side-step getDocument() entirely, and directly use the document URL as the image source. That way, the loading="lazy" attribute can be used and the image is only fetched if it's visible.

The deleted comment is wrong: authentication is required, but is performed via a cookie. Cookies are always sent for same-origin image requests.

@emersion emersion requested review from clarani and theocrsb December 4, 2024 10:06
@emersion emersion requested a review from a team as a code owner December 4, 2024 10:06
@github-actions github-actions bot added the area:front Work on Standard OSRD Interface modules label Dec 4, 2024
@emersion emersion self-assigned this Dec 4, 2024
Copy link
Contributor

@clarani clarani left a comment

Choose a reason for hiding this comment

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

LGTM ✅

We were unconditionally fetching the rolling stock image via
getDocument(). Instead, side-step getDocument() entirely, and
directly use the document URL as the image source. That way, the
loading="lazy" attribute can be used and the image is only fetched
if it's visible.

The deleted comment is wrong: authentication is required, but is
performed via a cookie. Cookies are always sent for same-origin
image requests.

Signed-off-by: Simon Ser <[email protected]>
@emersion emersion force-pushed the emr/lazy-rolling-stock-img branch from 7386777 to e3077ac Compare December 5, 2024 09:26
@emersion emersion enabled auto-merge December 5, 2024 09:27
@emersion emersion added this pull request to the merge queue Dec 5, 2024
Merged via the queue into dev with commit 21e6b6f Dec 5, 2024
27 checks passed
@emersion emersion deleted the emr/lazy-rolling-stock-img branch December 5, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:front Work on Standard OSRD Interface modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants