Skip to content

Conversation

ianshade
Copy link
Contributor

@ianshade ianshade commented May 26, 2025

About the Contributor

This pull request is posted on behalf of TV 2 Norge.

Type of Contribution

This is a:

Bug fix

Current Behavior

Updating Studio (Blueprint) Config using the HTTP API (updateStudioConfig operation) resulted in other Studio settings, e.g. peripheral devices to be lost.

New Behavior

Settings of the existing studio are preserved

Testing

  • I have added one or more unit tests for this PR
  • I have updated the relevant unit tests
  • No unit test changes are needed for this PR

Affected areas

This PR affects the HTTP API, specifically operations that update a Studio

Time Frame

Not urgent for us

Other Information

Status

  • PR is ready to be reviewed.
  • The functionality has been tested by the author.
  • Relevant unit tests has been added / updated.
  • Relevant documentation (code comments, system documentation) has been added / updated.

ianshade added 2 commits May 26, 2025 12:40
properties not present in apiStudio needed to be taken from the existing studio
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ianshade ianshade marked this pull request as ready for review August 25, 2025 21:43
@ianshade ianshade requested a review from a team as a code owner August 25, 2025 21:43
@nytamin nytamin requested a review from Copilot August 26, 2025 04:02
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 issue where updating Studio (Blueprint) Config via the HTTP API caused other Studio settings (like peripheral devices) to be lost. The fix preserves existing studio data when building updated studio objects.

  • Refactored the updateOverrides function to properly preserve existing overrides and handle complex object structures
  • Modified the studio building logic to preserve existing studio properties before applying API updates
  • Added comprehensive test coverage for the new override update behavior

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
packages/corelib/src/settings/objectWithOverrides.ts Completely rewrote updateOverrides function with improved logic for preserving overrides and handling nested objects
packages/corelib/src/settings/tests/objectWithOverrides.spec.ts Added extensive test cases covering various override update scenarios
meteor/server/api/rest/v1/typeConversion.ts Refactored studio creation to preserve existing studio fields using spread operator
meteor/server/api/rest/v1/tests/typeConversions.spec.ts Added new test file with tests for studio field preservation

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

value: rawValue,
})
}
if (typeof curValue === 'object' && typeof rawValue === 'object') {
Copy link
Preview

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

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

This condition doesn't handle null values properly since typeof null === 'object' in JavaScript. This could lead to errors when trying to recursively process null values. Add null checks: if (typeof curValue === 'object' && curValue !== null && typeof rawValue === 'object' && rawValue !== null)

Suggested change
if (typeof curValue === 'object' && typeof rawValue === 'object') {
if (
typeof curValue === 'object' && curValue !== null &&
typeof rawValue === 'object' && rawValue !== null
) {

Copilot uses AI. Check for mistakes.

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

Successfully merging this pull request may close these issues.

2 participants