Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate v2 to v3 #230

Closed
johnpapa opened this issue Jul 30, 2019 · 0 comments · Fixed by #225 or #261
Assignees
Labels
Milestone

Comments

@johnpapa
Copy link
Owner

@johnpapa johnpapa commented Jul 30, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.