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

Time queries with mobileToDesktop are non-idempotent #804

Closed
asapach opened this issue Dec 1, 2023 · 3 comments · Fixed by #805
Closed

Time queries with mobileToDesktop are non-idempotent #804

asapach opened this issue Dec 1, 2023 · 3 comments · Fixed by #805

Comments

@asapach
Copy link
Contributor

asapach commented Dec 1, 2023

When running browserslist Node api multiple times using time queries, the mobileToDesktop option seems to mutate the data so that the results are non-idempotent.

When first running browserslist('last 1 year') it returns the following list (notice only one android entry):

and_chr 119
and_ff 119
and_uc 15.5
android 119
chrome 119
...

However, once any mobileToDesktop query is executed it poisons the results:

browserslist(null, { mobileToDesktop: true });
...
browserslist('last 1 year');

Notice the multiple android entries:

and_chr 119
and_ff 119
and_uc 15.5
android 119
android 118
android 117
android 116
android 115
android 114
android 113
android 112
android 111
android 110
android 109
chrome 119
...

browserslist@4.22.1
caniuse-lite@1.0.30001565

@ai
Copy link
Member

ai commented Dec 2, 2023

Seems like we are not using immutable arrays somewhere.

Can you do the research and send PR with a fix?

@asapach
Copy link
Contributor Author

asapach commented Dec 2, 2023

Can you do the research and send PR with a fix?

Here you go: #805

@ai ai closed this as completed in #805 Dec 3, 2023
@ai
Copy link
Member

ai commented Dec 3, 2023

The fix was released in 4.22.2.

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