Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[AssetMapper] avoid caching MappedAsset inside JavaScript Import#52523

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

weaverryan
Copy link
Member

QA
Branch?6.4
Bug fix?yes
New feature?no
Deprecations?no
IssuesNone
LicenseMIT

Hi!

Subtle bug. In dev, we cache theMappedAsset objects. Before this PR,MappedAsset->javascriptImports[0]->asset was also aMappedAsset object.

Supposeapp.js importsfoo.js which importsbar.js. Then, the user changesfoo.js to also importbaz.js.

Thefoo.js MappedAsset will now have TWOJavaScriptImport objects (forbar.js andbaz.js). However, when we calculate the preloads, this happens:

  1. We load the cachedMappedAsset forapp.js because this file has not changed
  2. It correctly has 1JavaScriptImport forfoo.js
  3. But theJavaScriptImport->asset property holds an OUT-OF-DATE version of theMappedAsset forfoo.js... because it was cached inside theMappedAsset structure forapp.js. This out-of-dateMappedAsset forfoo.js only contains the ONE JavaScript import.

The result is thatbaz.js will be missing from the preloads.

This PR breaks the structure by only storing the asset's logical path (and sourcePath - needed by the cache system). Then, at runtime, we load the freshMappedAsset from the logical path.

Cheers!

@weaverryanweaverryanforce-pushed theasset-mapper-avoid-caching-mapped-asset branch fromc6009ce tocaf7fcbCompareNovember 10, 2023 02:27
The problem is that these could get out of date, allowing asset Foo to have aJavaScript import for the MappedAsset for Bar, but it is out of date becauseBar has since changed.
@weaverryanweaverryanforce-pushed theasset-mapper-avoid-caching-mapped-asset branch fromcaf7fcb tobb5ef88CompareNovember 10, 2023 02:31
@fabpotfabpot merged commita647f55 intosymfony:6.4Nov 10, 2023
This was referencedNov 10, 2023
@weaverryanweaverryan deleted the asset-mapper-avoid-caching-mapped-asset branchNovember 11, 2023 01:35
xabbuh added a commit that referenced this pull requestNov 24, 2023
This PR was merged into the 6.4 branch.Discussion----------[AssetMapper] Fix windows ci fail| Q             | A| ------------- | ---| Branch?       | 6.4| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Issues        | Fixes CI| License       | MITI missed the windows-only test in#52523.Cheers!Commits-------e172b68 [AssetMapper] Fixing out-of-date test on Windows
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

Assignees
No one assigned
Projects
None yet
Milestone
6.4
Development

Successfully merging this pull request may close these issues.

4 participants
@weaverryan@nicolas-grekas@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp