[PR #9964] [MERGED] Serialize stub for dynamic profiles #27830

Open
opened 2026-01-31 09:24:32 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/9964
Author: @carlos-zamora
Created: 4/27/2021
Status: Merged
Merged: 4/28/2021
Merged by: @undefined

Base: mainHead: dev/cazamor/bugfix/9962


📝 Commits (2)

  • 219edc9 Serialize stub for dynamic profiles
  • 5d71ca9 Apply suggestions from code review

📊 Changes

1 file changed (+9 additions, -4 deletions)

View changed files

📝 src/cascadia/TerminalSettingsModel/Profile.cpp (+9 -4)

📄 Description

#9962 was caused by a serialization bug. Technically, ToJson works
as intended: if the current layer has any values set, write them out to
the json. However, on first load, the dynamic profile Profile objects
are actually empty (because they inherit from base layer, then the
dynamic profile generator). This means that ToJson writes the dynamic
profiles as empty objects {}. Then, on reload, we see that the dynamic
profiles aren't in the JSON, and we write them again.

To get around this issue, we added a simple check to Profile::ToJson:
if we have a source, make sure we write out the name, guid, hidden, and
source. This is intended to align with Profile::GenerateStub.

Closes #9962


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/9964 **Author:** [@carlos-zamora](https://github.com/carlos-zamora) **Created:** 4/27/2021 **Status:** ✅ Merged **Merged:** 4/28/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/cazamor/bugfix/9962` --- ### 📝 Commits (2) - [`219edc9`](https://github.com/microsoft/terminal/commit/219edc99868fa91e0e1b1380a2d3bef7f12f30cd) Serialize stub for dynamic profiles - [`5d71ca9`](https://github.com/microsoft/terminal/commit/5d71ca94e31e7a8154a0e5a357a78c01b7b80f64) Apply suggestions from code review ### 📊 Changes **1 file changed** (+9 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalSettingsModel/Profile.cpp` (+9 -4) </details> ### 📄 Description #9962 was caused by a serialization bug. _Technically_, `ToJson` works as intended: if the current layer has any values set, write them out to the json. However, on first load, the dynamic profile `Profile` objects are actually empty (because they inherit from base layer, then the dynamic profile generator). This means that `ToJson` writes the dynamic profiles as empty objects `{}`. Then, on reload, we see that the dynamic profiles aren't in the JSON, and we write them again. To get around this issue, we added a simple check to `Profile::ToJson`: if we have a source, make sure we write out the name, guid, hidden, and source. This is intended to align with `Profile::GenerateStub`. Closes #9962 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:24:32 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27830