Avoid duplicating assets when they have params #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BUG 1: If you do
You get
@kaidesu @thekanbo this PR avoid duplicating the same file on assets
BUG 2:
! in_array($assets, $collection)is alwaysfalsebecausein_array('test', ['test'=>[]]))is false,array_keysis needed, Demo Linkbonsai/src/Assets.php
Lines 173 to 175 in 466603f
BUG 3: There is a bug because if you do something like this
as
'example.js'already exists,$this->lastAddedAssetis'test.js', sodependsOnputnamespaceas dependency on'test.js'instead of'example.js', that is why$this->lastAddedAssetmust be out of! in_array($assets, $collection)(it's currently working because always
falsemakes replace the key all the time, when you fix the condition! in_array($assets, $collection)witharray_keysthe bug pop up)bonsai/src/Assets.php
Lines 65 to 72 in 466603f