Skip to content

Fix/portal webappform#81

Merged
digmunhoz merged 2 commits intomainfrom
fix/portal-webappform
Feb 27, 2026
Merged

Fix/portal webappform#81
digmunhoz merged 2 commits intomainfrom
fix/portal-webappform

Conversation

@digmunhoz
Copy link
Copy Markdown
Contributor

Description

Fixes a runtime and a build issue in the webapp form. When settings.command comes from the API as an array (e.g. ["python", "app.py"]) instead of a string, calling .trim() in hasAdvancedChanges caused Uncaught TypeError: settings.command.trim is not a function. The logic now supports both string and array: string is trimmed and checked for non-empty; array is checked for at least one non-empty element. TypeScript was narrowing command to never in the array branch (type is string | null), so cmd is typed as unknown in the helper and the .some() callback parameter is typed as unknown to fix tsc errors and allow the runtime array check.

Related Issue

Closes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📚 Documentation update
  • 🔧 Refactoring (no functional changes)
  • 🧪 Tests (adding or updating tests)
  • 🏗️ Infrastructure/CI changes

Component Affected

  • API (backend)
  • Portal (frontend)
  • Documentation
  • CI/CD
  • Other:

Checklist

General

  • I have read the CONTRIBUTING.md guidelines
  • My code follows the project's code style
  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • My changes generate no new warnings or errors

Testing

  • I have added tests that prove my fix/feature works
  • New and existing unit tests pass locally with my changes
  • I have tested my changes manually

Documentation

  • I have updated the documentation accordingly
  • I have updated the README if needed

Screenshots (if applicable)

N/A — logic-only fix.

Test Plan

  1. Open a webapp component form (create or edit) where the API returns settings.command as an array; confirm no console error and the "Advanced Settings" / "Modified" badge behave as before.
  2. Repeat with command as a string or null; confirm behavior unchanged.
  3. Run npm run build (or tsc --noEmit) in the portal and confirm no TypeScript errors.

Additional Notes

  • WebappSettings.command stays string | null in the types; the API can still return an array, so the code treats command as unknown only inside the hasAdvancedChanges helper for safe runtime handling.

@digmunhoz digmunhoz merged commit fcc3aae into main Feb 27, 2026
12 checks passed
@digmunhoz digmunhoz deleted the fix/portal-webappform branch March 8, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant