question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Label text doesn't change if options updated

See original GitHub issue

Version

  • 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

https://jsfiddle.net/cubk7z50/13/

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
adambereczcommented, Apr 6, 2021

@vesper8 now things should be fine with 1.3.7. @vitalybaev I had to change watcher to flush: 'pre' so when you’re changing options to a new language a tick will pass until the label will be refreshed.

1reaction
osi-oswaldcommented, Apr 1, 2021

Btw just some small unrelated sidenote: You are a beast @adamberecz!! 🙌🤩🤗

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found