Geo-Web-Project / browser

An interface that uses geolocation to navigate/resolve content on the Geo Web.
MIT License
3 stars 8 forks source link

fix: ensure modelIndex is always less than array length #60

Closed tnrdd closed 1 year ago

tnrdd commented 1 year ago

Description

When switching between models in the media gallery sometimes modelIndex in GWCanvas is set to be the same length of the mediaGallery array and it address to an index of an undefined element, causing gwContent.raw.get() to error out and the media content carousel to be stuck on the same model before the click.

This make sure modelIndex is not off by one and it always wrap around when it would be less than zero or equal the length of the array.

Issue

fixes #57

Checklist:

Alert Reviewers

@codynhat @gravenp

codynhat commented 1 year ago

I am still able to reproduce the original issue. It happens also when not at the end of the media gallery, and only when the objects are not cached.

tnrdd commented 1 year ago

I thought the freezing was only because of the out of bound access error but besides that when switching on first load the old model remained a second displayed while the name of the new model was already showing. It now should show a spinner until the new model is loaded.

codynhat commented 1 year ago

Looks good now!