DigitalCommons / mykomap

A web application for mapping initiatives in the Solidarity Economy
3 stars 0 forks source link

`defaultOpenSidebar` option seems not to work in MM 3.1.4 #226

Closed wu-lee closed 7 months ago

wu-lee commented 9 months ago

Describe the bug If the defaultOpenSidebar configuration option is set in a mykomap page, the sidebar doesn't open automatically on opening the map. Appears to be the case whether or not this compiled into the config or is set in the URL parameters.

To Reproduce This is manifesting in the new ICA map at https://dev.maps.coop/ica/.

See https://github.com/DigitalCommons/ica-project/issues/27#issuecomment-1855529906

Currently you can just visit that above URL, and note that the sidebar is not open.

To attempt to reproduce it in other maps, append ?defaultOpenSidebar=true to the map URL

Expected behavior The sidebar should be opened automatically when the map is opened.

Additional context

wu-lee commented 9 months ago

It's not clear why this is happening. There are no errors I can detect.

It appears to be the result of a promise resolution not occurring when the webpage has loaded. The code which opens the sidebar is just not run as a resolution of the promise. Inserting trace logs, the resolution appears not to be failing either.

wu-lee commented 8 months ago

Note that as mentioned in the ObO issue above, this appears not to be a problem there...

wu-lee commented 7 months ago

I've found that the sidebar load can fail when the vocabs don't load in time, and an exception is thrown, which aborts the routine which does the opening.

This was masked by a rejected promise with no handler, so the error wasn't reported anywhere, and the fact that the vocabs are there later when the sidebar is opened manually, so everything then works. I've added a handler which reports errors like this on the console.

I've also altered the code slightly to avoid trigging this error - when vocabs are not available the sidebar is populated in a best-effort manner, instead of throwing an exception. Which should be temporary, as mentioned.

This allows the sidebar auto-opening to complete successfully.

Fix is in Mykomap v3.1.5

wu-lee commented 7 months ago

Small consequence of the above: on initial page load, sidebar opens, only "All Entries" shows for a moment, then the entries appear.

ColmDC commented 7 months ago

Confirm it works in https://dev.maps.coop/ica/ on Firefox.

Small consequence of the above: on initial page load, sidebar opens, only "All Entries" shows for a moment, then the entries appear.

Not a problem.