Skip to content

Setting value prop immediately after component initialization may not work #9

@Lifulifu

Description

@Lifulifu

Expected behavior:

CodeMirror should always render the value of value prop.

Bug

Under rare circumstances, the value of value may not match what is rendered.
For example, the final value that is rendered in CodeMirror should be "second", but can sometimes be "first".

<script>
let value = "first";
onMount(() => {
    value = "second"
})
</script>

<CodeMirror bind:value />

This bug can be solved by not returning on this line, so that editor state is always updated when value changes.

This bug may be caused by this line, if view and value change at the same tick, the second change of value may be marked as the first change and update is skipped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions