Skip to content

OL: fix style type switching and stale event listeners on style change#287

Merged
dannyleech merged 1 commit into
DEFRA:mainfrom
jsmith-informed:fix/ol-multi-type-style-switch
May 20, 2026
Merged

OL: fix style type switching and stale event listeners on style change#287
dannyleech merged 1 commit into
DEFRA:mainfrom
jsmith-informed:fix/ol-multi-type-style-switch

Conversation

@jsmith-informed
Copy link
Copy Markdown
Contributor

Fixes an issue switching between different types via the mapStylesPlugin, e.g going from vector to raster would try load using the wrong path and error. The tileloadend listener would also end up stale for vector types.

Combined layer creation logic into createMapStyleLayer, dropping the reuse of the source so raster now recreates to match the other types. Listeners are now kept up to date on switches with the onBaseSourceChange callback.

Removed the unused tileLayer and source properties form the provider instance to avoid keeping them in sync.

@dannyleech
Copy link
Copy Markdown
Contributor

Looks great!

@dannyleech dannyleech merged commit 3d04013 into DEFRA:main May 20, 2026
1 check failed
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.

2 participants