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

IKImage not rendering after upload using Hooks #36

Closed
Enaliz opened this issue May 13, 2021 · 5 comments
Closed

IKImage not rendering after upload using Hooks #36

Enaliz opened this issue May 13, 2021 · 5 comments

Comments

@Enaliz
Copy link

Enaliz commented May 13, 2021

Hi Im trying to have IKImage reload after a successful upload but it's not working.

Can you tell me what I'm doing wrong ?

`
const NewPost = () => {

const [imageURL, setImageURL] = useState("/default-image.jpg");

const onError = err => {
    console.log("Error", err);
};

const onSuccess = res => {
    console.log("Success", res);
    setImageURL(res.filePath);
};


return (
    <div>
        <div className="content_row">
            <div className="post_creator">
                <div className="editor">
                    <IKContext
                        publicKey={publicKey}
                        urlEndpoint={urlEndpoint}
                        authenticationEndpoint={authenticationEndpoint}
                    >
                        <p>Upload an image</p>
                        <IKUpload
                            fileName="test-upload.png"
                            onError={onError}
                            onSuccess={onSuccess}
                        />
                    </IKContext>
                </div>
                <div className="post_rendered">
                    <div className="post_photo">
                        <IKContext urlEndpoint={urlEndpoint}>
                            <IKImage
                                path={imageURL}
                                loading="lazy"
                                lqip={{ active: true, quality: 20, blur: 30 }}
                            />
                        </IKContext>
                    </div>
                </div>


            </div>
        </div>
    </div>
);

}`

@Enaliz Enaliz changed the title IKImage not reloading after upload using useState IKImage not reloading after upload using Hooks May 13, 2021
@Enaliz Enaliz changed the title IKImage not reloading after upload using Hooks IKImage not rendering after upload using Hooks May 13, 2021
@imagekitio
Copy link
Contributor

@Enaliz thanks for reporting. We are working on a fix which will be released in the next version.

@Enaliz
Copy link
Author

Enaliz commented May 13, 2021

@imagekitio thx for the feedback. Do you already have any idea about the fix release date ?

@imagekitio
Copy link
Contributor

Roughly 2 weeks from now

@Enaliz
Copy link
Author

Enaliz commented May 13, 2021

@imagekitio Great thx! Beside that glitch the service is awesome btw

@Enaliz
Copy link
Author

Enaliz commented May 14, 2021

FYI and I don't know if it's related but IKImage is not rendering either when called after a map function:

{blogPost.map((post, i) => { return ( <div className="blog_post_card"> <div className="blog_post_photo"> <IKImage urlEndpoint={urlEndpoint} path={post.img_url} transformation={[{ height: 300 }]} loading="lazy" height="300" /> </div> ); }) }

nikniv added a commit that referenced this issue Jun 3, 2021
…ts into multiple/e2e-ikimage-bugfix

Fix for issue #36 and cypress e2e tests for lazy loading and lqip
@nikniv nikniv closed this as completed in 4c27545 Jun 9, 2021
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

No branches or pull requests

2 participants