{"action":"created","issue":{"url":"https://api.github.com/repos/quasarframework/quasar/issues/1691","repository_url":"https://api.github.com/repos/quasarframework/quasar","labels_url":"https://api.github.com/repos/quasarframework/quasar/issues/1691/labels{/name}","comments_url":"https://api.github.com/repos/quasarframework/quasar/issues/1691/comments","events_url":"https://api.github.com/repos/quasarframework/quasar/issues/1691/events","html_url":"https://github.com/quasarframework/quasar/issues/1691","id":302098384,"number":1691,"title":"QInput v-model.trim is too eager","user":{"login":"dsl101","id":900542,"avatar_url":"https://avatars0.githubusercontent.com/u/900542?v=4","gravatar_id":"","url":"https://api.github.com/users/dsl101","html_url":"https://github.com/dsl101","followers_url":"https://api.github.com/users/dsl101/followers","following_url":"https://api.github.com/users/dsl101/following{/other_user}","gists_url":"https://api.github.com/users/dsl101/gists{/gist_id}","starred_url":"https://api.github.com/users/dsl101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsl101/subscriptions","organizations_url":"https://api.github.com/users/dsl101/orgs","repos_url":"https://api.github.com/users/dsl101/repos","events_url":"https://api.github.com/users/dsl101/events{/privacy}","received_events_url":"https://api.github.com/users/dsl101/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-04T16:16:42Z","updated_at":"2018-03-04T17:59:26Z","closed_at":"2018-03-04T17:59:26Z","author_association":"CONTRIBUTOR","body":"<!--\r\n\r\nGot a question?\r\n===\r\nThe issue list of this repo is **exclusively** for bug reports and feature requests. For simple questions, please use the following resources:\r\n\r\n- Read the docs: http://quasar-framework.org\r\n- For simple/quick questions ask on the Discord chat room: https://discord.gg/5TDhbDg\r\n- For complex questions or requiring help, ask on the forum: http://forum.quasar-framework.org/\r\n\r\nReporting a bug?\r\n================\r\n- Are you sure it isn't already reported? Do a search first! It may have already been answered or even fixed in the development branch (`dev`).\r\n\r\n- If you are reporting a bug for Quasar v0.15+, then please try to include a forked JsFiddle/Codepen from one of these: https://jsfiddle.net/rstoenescu/waugrryy/ (jsFiddle - Material theme) or https://jsfiddle.net/rstoenescu/7gu065yg/ (jsFiddle - iOS theme) or https://codepen.io/rstoenescu/pen/KQRZJg (Codepen - Material theme) or https://codepen.io/rstoenescu/pen/paVpBN (Codepen - iOS theme)\r\n\r\n- Are you sure you are reporting to the right repo? If you are not reporting an issue which deals directly with Quasar distributable, then there are [multiple Quasar repos](https://github.com/quasarframework) besides this one:\r\n  -- Quasar CLI: https://github.com/quasarframework/quasar-cli\r\n  -- Quasar Starter Kit (project folder template): https://github.com/quasarframework/quasar-template-default\r\n  -- Electron Wrapper: https://github.com/quasarframework/electron-wrapper\r\n  -- Quasar Play: https://github.com/quasarframework/quasar-play\r\n  -- Documentation Website: https://github.com/quasarframework/quasar-framework.org\r\n\r\n- Check if the issue is reproducible with the latest stable version of Quasar. If you are using a pre-release, please indicate the specific version you are using.\r\n\r\n- It is **required** that you clearly describe the steps necessary to reproduce the issue you are running into. Issues with no clear repro steps will not be triaged. If an issue labeled \"need repro\" receives no further input from the issue author for more than 5 days, it will be closed.\r\n\r\n- If your issue is resolved but still open, don’t hesitate to close it. In case you found a solution by yourself, it could be helpful to explain how you fixed it.\r\n\r\nHave a feature suggestion/request?\r\n=======================\r\nRemove the template from below and provide thoughtful commentary *and code samples* on what this feature means for your product. What will it allow you to do that you can't do today? How will it make current work-arounds straightforward? What potential bugs and edge cases does it help to avoid? etc. Please keep it product-centric.\r\n-->\r\n\r\n<!-- BUG REPORT TEMPLATE -->\r\n### Software version\r\n\r\nQuasar: 0.15.\r\nOS:\r\nNode:\r\nNPM:\r\nBrowsers:\r\niOS:\r\nAndroid:\r\nAny other software related to your bug:\r\n\r\n### JsFiddle (for Quasar v0.15+ only)\r\nhttps://codepen.io/anon/pen/WMBvZR\r\n\r\n### What did you get as the error?\r\nWhen editing a text input with `v-model.trim=\"data\"`, it is very awkward to delete words that are separated by spaces, as the `trim()` happens on every change and therefore 'consumes' the space that would separate words.\r\n\r\nE,g. type \"Step 1\" into the text input and then delete the '1' and replace it with a '2\". For a plain `input` element, this ends with \"Step 2\", but for `q-input` it ends with \"Step2\" unless great care is taken.\r\n\r\n### What were you expecting?\r\n\r\n`q-input` would behave the same as `input`, and not erase spaces _during_ editing.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/quasarframework/quasar/issues/comments/370249353","html_url":"https://github.com/quasarframework/quasar/issues/1691#issuecomment-370249353","issue_url":"https://api.github.com/repos/quasarframework/quasar/issues/1691","id":370249353,"user":{"login":"rstoenescu","id":4665641,"avatar_url":"https://avatars0.githubusercontent.com/u/4665641?v=4","gravatar_id":"","url":"https://api.github.com/users/rstoenescu","html_url":"https://github.com/rstoenescu","followers_url":"https://api.github.com/users/rstoenescu/followers","following_url":"https://api.github.com/users/rstoenescu/following{/other_user}","gists_url":"https://api.github.com/users/rstoenescu/gists{/gist_id}","starred_url":"https://api.github.com/users/rstoenescu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rstoenescu/subscriptions","organizations_url":"https://api.github.com/users/rstoenescu/orgs","repos_url":"https://api.github.com/users/rstoenescu/repos","events_url":"https://api.github.com/users/rstoenescu/events{/privacy}","received_events_url":"https://api.github.com/users/rstoenescu/received_events","type":"User","site_admin":false},"created_at":"2018-03-04T17:59:26Z","updated_at":"2018-03-04T17:59:26Z","author_association":"OWNER","body":"While this works for native inputs, it cannot work with v-model on components. This is due to how Vue works.\r\n\r\nExplanation:\r\n1. v-model is equivalent to `<q-input :value=\"model\" @input=\"val => { model = val}\"`\r\n2. when using trim modifier with v-model, you have the following sequence:\r\n    - you type \"Step 1\" a series of `@input` events are triggered, each time trimming and updating the model (eventually setting it to \"Step 1\")\r\n    - Every `@input` Vue event triggers a QInput re-render with the new value (due to `:value` having a new value for it)\r\n    - you delete \"1\" -> model is trimmed and set to \"Step\" instead of \"Step \" (notice the space)\r\n    - QInput gets re-rendered with the trimmed value, which is \"Step\"\r\n\r\nUse lazy loading (check docs, it explains it very well) OR an equivalent `:value - @input` to fit your needs."}}
{"actor":{"display_login":"rstoenescu"}}