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

ImageSource's .updateImage() while loading #1798

Closed
blinkzz opened this issue Oct 31, 2022 · 3 comments · Fixed by #1802
Closed

ImageSource's .updateImage() while loading #1798

blinkzz opened this issue Oct 31, 2022 · 3 comments · Fixed by #1802

Comments

@blinkzz
Copy link
Contributor

blinkzz commented Oct 31, 2022

It looks like .updateImage() is being ignored before initial image finishes loading

updateImage(options: {
url: string;
coordinates?: Coordinates;
}) {
if (!this.image || !options.url) {
return this;
}
this.options.url = options.url;
this.load(options.coordinates, () => { this.texture = null; });
return this;
}

Is there any particular reason why we are not allowed to change image on fly before initial one is loaded?

@HarelM
Copy link
Collaborator

HarelM commented Oct 31, 2022

Might be a race condition issue, I guess. But I don't have anything concrete to relay on, it's just a hunch.

@blinkzz
Copy link
Contributor Author

blinkzz commented Oct 31, 2022

Well, true
But at the same time, race condition will definetly occur when updateImage is being called twice with different url's (after initial image is loaded, since this.image is will be truthy now)
I guess the only possible solution to this is to keep reference to last http request being made and cancel it via AbortController or simillar API?

@HarelM
Copy link
Collaborator

HarelM commented Oct 31, 2022

Sounds about right... :-)

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 a pull request may close this issue.

2 participants