-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
useOffsetPagination attempted mutation of ref #3542
Comments
I didn't find any error in the playground you provided, and it seems to be intentional to mutate the pageSize according to the source code |
An error happens when you have a computed value for pagesize In addition, if the value is already the output value, (perPage is the original ref, and currentPageSize being the output) if the output already has the correct value, then perPage should not be mutated, just use currentPageSize. The only thing perPage should do is make a sync value, if it changes, currentPageSize should change. |
Subsequently, if you are using a readonly value such as a computed, then the entire composable simply refuses to work, since the currentPage cannot get updated. |
It seems that it will indeed mutate |
Describe the bug
When using a value for pageSize or page in useOffsetPagination, it attempts to mutate the value
As shown in the playground instance, it runtime fails with
Write operation failed: computed value is readonly
(when the value is a computed, refs it will mutate directlyReproduction
https://play.vueuse.org/#N4IgDghgxg1hDmBTAziAXAbVAOwgW0XRADcBXRAWgBNE8BLEAGhGQHtSAnKQtEU7MDHhMQNZFA50wAFzqtsRAGrkABABFadFQAoAFhAA2AMxV1sKgGIdE2KLoCUp5CogqaxRAdZgz8FaVkDOmkATxcDLwB3ZxD2FWlWFUjJaUQVAFVsOg8OZEMVZTSAGToAIw4ISRQVI1YOAtUAJhUAMhUAZhFOAyJdaWkwZDQAemH+QXgAOihWPGGyShp6YaDS4bMaAA9JvAArVABfRhx8HhAAAQXSZERh5H1rKhE2Tm4icaERMQkpWXkiADKD0QVAaiHSN38gWCdBQky6HB6vD6AyGow+Uxmc0u5Gut3ulRB5wAjAAGSbEyak9bYLY7fYgI4nAhEHGIPHDGbWZ7sLhnDFfFA-GRyBS8ADCrAiiCgf3MrBMKBu2Fk+UKKkleDArGQMPkGWhshQCKRIBRgxGYwEQmms2GbI5XMQJPJlOpG0Q2z2hwAuswjHQDMa0KAAIJgMCTBboUCpLUGCCpIgAHio2QAfAAdcwqVMZ7MqFTAYAQA4HAu54Zp4hZnN5msV4tgRAcAAKCEQZYrhe0eACiZBNQ4sxUpPiiWJKn1eHYKsH2jqKjYBCn0l0LZUQSMMpCUCD9nsFeTVfzdertcLxagnGsKvbSDLOj70gHzn1pQCCXMe7osEPdZPBs6w-fp9XOH9YAAXkzEBShg9NxSCWAVAIY8QK-C9K3PZ5hWkIg6C1OppCLfwbgAeSMIwbmke8zETUUVAOIcRwAcgdG5OTqRAWOzAjtQ4YjgGsIxGBULEwACEEmKMYc8BUFiFh47BsxmbBkGI4JaGcSCxNmCTUiobRtEcSD0xUDBiUYRpGHaRgABZGAAVkYAA2RgAHZGAADkYABOH1-xU+R1LEm8bBojsVB04TtGJf9VJC5s20i6LECMbRSUC2xguI1wdLxCiqMQCL4DouVtGACsEhfAw0B0EyzM0vBkCjQxyEmINsHgNdGArSAkABOgAC9EDqpL70QXqc360bQo4W8SsQbMDiyhLiNKKL6qiszKpzCBJmwT1pGM5bs0ZZhJTqNNcFSKNyBjEA4zABMk14esK1qFVoJAGdsFYGCK1KeBvqCeA+goRzSTHKhKhgNAYY4GAIahgGcyMINNm+gA-XSDFRwtUk2aRvu4OcOHxlQwG+xoKdKK6W2+4d+BoKhUcw5NkEgcxCeJmC7M2PGQHTYsVGINq0jLY9OYgbB2el7mju+5A5IRuHQfB3yobcWG0G8aBghCZGYJQ77pAoGmhYAWXYSERYTUpPEYg4pa52tj2w5hxEkGQiBoANDtbYdBgqit7c8OqAWkSQuqmwsxYMcg6oAOVIPAHY4KaVsZMsgA
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: