Skip to content

Conversation

remihuigen
Copy link

Problem

The id ref does not get populated when the component mounts, showing a video interface without a selected video file (even if the component props have an id value)

Solution

Set the responsible watcher immediate prop to true

watch(() => props.value, setServiceAndID, { immediate: true });

function setServiceAndID() {
  if (!props.value) return;

  service.value = props.value.service;

  if (service.value === 'directus') {
    fileID.value = props.value.id;
    return;
  }

  id.value = props.value.id;
}

NOT: this exact behavior is already present in the audio-interface

By setting the watcher to immediate, the id and service refs are populated when the components mount
@remihuigen remihuigen changed the title fix: setServiceAdnID watcher as immediate fix: setServiceAndID watcher as immediate Aug 13, 2025
@remihuigen remihuigen closed this Aug 18, 2025
@remihuigen remihuigen reopened this Aug 20, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an initialization issue where the video interface component doesn't display the selected video file when mounting with an existing ID value. The fix makes the watcher that handles service and ID initialization run immediately on component mount.

  • Updated the props.value watcher to include the immediate: true option

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants