Skip to content

Conversation

@Andriiuxa
Copy link
Contributor

@Andriiuxa Andriiuxa commented Oct 24, 2019

Fixes #
instead of having empty string in background-image, don't have background-image at all instead when there is not placeholderSrc passed

Description
background-image: "", makes a network call to this empty URL, instead it should just not be there in the first place if it was not specified

So at the moment we have to do something like this, to avoid a network call being made to ""

      <LazyLoadImage
        alt={imageAlt}
        src={`https://asapcdn.com/resize/?w=366&h=233&pad=true&i=${imageSrc}`}
        height="auto"
        style={{
          maxWidth: '100%',
          maxHeight: maxHeight || ''
        }}
        visibleByDefault={!lazyLoad}
        effect="blur"
        placeholderSrc={
          'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='
        }
      />

https://imgur.com/a/E2O8zNQ - screenshot

cc - @Aljullu

Copy link
Owner

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

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

Thanks for creating this PR @Andriiuxa! I added a small suggestion to make code more concise but this is overall looking good.

@Aljullu Aljullu merged commit 9e837c0 into Aljullu:master Nov 10, 2019
@Aljullu
Copy link
Owner

Aljullu commented Nov 10, 2019

Thanks for applying the feedback @Andriiuxa, I merged your changes and released a new beta version.

Feel free to test it with npm i --save react-lazy-load-image-component@1.4.0beta.1 and report any issues you find.

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.

3 participants