Fix view disappearing when switching from WORKSPACE to UNLISTED visibility#16289
Conversation
Greptile OverviewGreptile SummaryThis PR fixes a bug where views disappear when switching visibility from WORKSPACE to UNLISTED. Root Cause: The
Fix: Adding Validation: The fix is well-aligned with:
Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant ViewResolver
participant ViewV2Service
participant FlatViewUtils
participant MigrationService
participant Database
User->>ViewResolver: Update view (visibility: UNLISTED)
ViewResolver->>ViewV2Service: updateOne(updateViewInput)
ViewV2Service->>FlatViewUtils: fromUpdateViewInputToFlatViewToUpdateOrThrow()
Note over FlatViewUtils: Extracts properties in FLAT_VIEW_EDITABLE_PROPERTIES
FlatViewUtils-->>ViewV2Service: flatViewFromUpdateInput
alt Visibility changed from WORKSPACE to UNLISTED
ViewV2Service->>ViewV2Service: Set createdByUserWorkspaceId = userWorkspaceId
Note over ViewV2Service: Now detected because property<br/>is in FLAT_VIEW_EDITABLE_PROPERTIES
end
ViewV2Service->>MigrationService: validateBuildAndRunWorkspaceMigration()
Note over MigrationService: Compares properties in FLAT_VIEW_EDITABLE_PROPERTIES<br/>to detect changes and create update actions
MigrationService->>Database: Persist changes including createdByUserWorkspaceId
Database-->>User: View updated successfully (still visible)
|
f914b15 to
53dabfa
Compare
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:51082 This environment will automatically shut down when the PR is closed or after 5 hours. |
|
Hey @FelixMalfait! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
Description
When switching a view's visibility from WORKSPACE to UNLISTED, the code in
view-v2.service.tscorrectly setscreatedByUserWorkspaceIdto the current user (to prevent the view from disappearing). However, this property was not included inFLAT_VIEW_EDITABLE_PROPERTIES, which meant:This fix adds
createdByUserWorkspaceIdto the editable properties so the change is properly detected and persisted.Might fix #15955