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

Align getStyle() behavior and documentation #15826

Merged
merged 1 commit into from
May 15, 2024

Conversation

ahocevar
Copy link
Member

Currently, the documentation for the BaseVector layer's getStyle() method says:

Get the style for features. This returns whatever was passed to the style option at construction or to the setStyle method.

This is not correct:

  1. When no style is configured that way, the default style is returned. This is even covered by an existing test for setStyle().
  2. When a flat style is configured that way, the style function created for that flat style is returned.

This pull request makes it so that 1. is properly documented, and that for 2., the passed flat style is returned by getStyle(), as documented.

Copy link

📦 Preview the website for this branch here: https://deploy-preview-15826--ol-site.netlify.app/.

@ahocevar ahocevar marked this pull request as ready for review May 14, 2024 19:59
@santilland
Copy link

This is really helpful to be able to work more easily with flat styles, great! thanks!

@ahocevar ahocevar merged commit 05b7a02 into openlayers:main May 15, 2024
8 checks passed
@ahocevar ahocevar deleted the get-style branch May 15, 2024 13:19
@alecarn
Copy link

alecarn commented May 16, 2024

Should this type of change should be considered as breaking change and what is your versioning policy?

In our case, our apps and library broke because we allowed the minor version to be automatically updated.

@ahocevar
Copy link
Member Author

Sorry if this change broke your app. According to our semantic versioning policy, It was a bug fix (function did not do what the API documentation said), so a minor version increase. Were you using getStyle() instead of getStyleFunction() to get the style function?

@alecarn
Copy link

alecarn commented May 17, 2024

Maybe the Typescript signature changes should be considered a breaking change?
Because this is not the only errors of type where our application failed. We were wondering if we should fix to the patch version of ol to ensure more stability and let's our maintainer catch this kind of changes up front.

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.

None yet

4 participants