Skip to content

Migrate v2 to v3 #230

@johnpapa

Description

@johnpapa

Problem

Users of Peacock v2+ are using a memento peacockMementos.peacockColor that stores the color that is applied to each workspace. This has been removed in v3 and now Peacock uses a worskspace setting named peacock.color.

When a user upgrade to v3, any colors previously applied would be removed since peacock.color is not present in their workspace (because it did not exist in v2).

The Goal and Expected Behavior

When a user upgrades to v3, their existing colors applied should still work.

Possible Solution

  • [scenario 1] v3 would look for a workspace peacock.color. If it exists, proceed as normal. There is no problem.

  • [scenario 2] If there is no workspace peacock.color, then look for the old memento. If that memento exists, write it to the workspace so the color is applied.

  • [scenario 3] If neither exists (which will be the case for new users), nothing will be done.

This logic may look similar to this pseudo-code

function onActivate() {
  const peacockColorSetting = workspace.get('peacock.color');
  if (peacockColorSetting) {
    return;
  }

  const peacockColorMemento = mementos.get('peacockMementos.peacockColor');
  if (peacockColorMemento) {
    await workspace.update('peacock.color', peacockColorMemento);
    await mementos.delete('peacock.color');
  }

  return;
}

This code could go away in a future version after a period of time.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions