Label text doesn't change if options updated
See original GitHub issueVersion
- Vue version: 3
Description
We have typical use case: country select, translated to several locales. Options is array of objects:
const options = [{code: 'au', name: 'Autstralia'}]
If we have selected value au
for example in English locale, our label shows Australia
. But when change locale for example to Russian (ru
), and update options, label will remain the same
I wrote test-case for this to clear our problem:
it('should reactively changes label when options has been changed', () => {
let select = createSelect({
value: 'ru',
label: 'name',
valueProp: 'code',
options: [{ code: 'au', name: 'Australia' }, { code: 'ru', name: 'Russia' }, { code: 'us', name: 'USA' }],
})
select.vm.options = [{ code: 'au', name: 'Австралия' }, { code: 'ru', name: 'Россия' }, { code: 'us', name: 'США' }]
expect(select.find('.multiselect-single-label').element).toBeVisible()
expect(select.find('.multiselect-single-label').html()).toContain('Россия') // <---- Fails here, but shouldn't
})
Demo
Issue Analytics
- State:
- Created 3 years ago
- Comments:11
Top Results From Across the Web
Label Text not changing - Stack Overflow
I thought of using a label text to show the different status messages, but the label text only shows the last status message...
Read more >Label text doesn't get updated in update panel - MSDN
In short, label's text gets updated 2nd time only when some server side event occurs. Like clicking on close button of modal popup....
Read more >Label text does not change when text parameter is modified ...
I used a debugger to step through and what I found is that after the text is changed, the text property of the...
Read more >how to put a variable in a LABEL, and always keep updating ...
I put a variable to stay in a LABEL, but when I update this variable this LABEL does not update. extends CanvasLayer export...
Read more >godot - Label text not updating every frame
Your script is updating the content of the Label. The reason you don't see updates is that the content itself isn't changing.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@vesper8 now things should be fine with
1.3.7
. @vitalybaev I had to change watcher toflush: 'pre'
so when you’re changing options to a new language a tick will pass until the label will be refreshed.Btw just some small unrelated sidenote: You are a beast @adamberecz!! 🙌🤩🤗