diff --git a/core/src/components/select/select.tsx b/core/src/components/select/select.tsx index 7b9f4b704e..22c1432833 100644 --- a/core/src/components/select/select.tsx +++ b/core/src/components/select/select.tsx @@ -133,8 +133,21 @@ export class Select implements ComponentInterface { @Listen('ionSelectOptionDidUnload') async selectOptionChanged() { await this.loadOptions(); + if (this.didInit) { this.updateOptions(); + + /** + * In the event that options + * are not loaded at component load + * this ensures that any value that is + * set is properly rendered once + * options have been loaded + */ + if (this.value !== undefined) { + this.el.forceUpdate(); + } + } } diff --git a/core/src/components/select/test/async/e2e.ts b/core/src/components/select/test/async/e2e.ts new file mode 100644 index 0000000000..c6bcd7f727 --- /dev/null +++ b/core/src/components/select/test/async/e2e.ts @@ -0,0 +1,10 @@ +import { newE2EPage } from '@stencil/core/testing'; + +test('select: async', async () => { + const page = await newE2EPage({ + url: '/src/components/select/test/async?ionic:_testing=true' + }); + + const compare = await page.compareScreenshot(); + expect(compare).toMatchScreenshot(); +}); diff --git a/core/src/components/select/test/async/index.html b/core/src/components/select/test/async/index.html new file mode 100644 index 0000000000..1c28d31088 --- /dev/null +++ b/core/src/components/select/test/async/index.html @@ -0,0 +1,37 @@ + + + + + + Select - Async + + + + + + + + + + + + +