zed icon indicating copy to clipboard operation
zed copied to clipboard

workspace: Set default value for LocalPathsOrder in query from DB for recent workspaces

Open CharlesChen0823 opened this issue 1 year ago • 1 comments

Closes #16119

I found the value LocalPathsOrder in self.recent_workspaces() not used before #12844, after #12844, using LocalPathsOrder to display recent project, but the value in DB might be empty for older release. So I add default value for LocalPathsOrder in query from DB.

Don't known if this is expect?

Release Notes:

  • N/A

CharlesChen0823 avatar Aug 13 '24 13:08 CharlesChen0823

сс @eth0net in case you want to check on that

SomeoneToIgnore avatar Aug 13 '24 14:08 SomeoneToIgnore

This does not make any sense — if the input data is wrong, we can sanitize it before INSERT/UPDATE.

I think you are right, becasue this code don't fix for the value is wrong.

IMO, this fix only for UX where update Zed for old release, this also don't need fix.

  1. LocalPathsOrder is add serialized in #11504, before release #11504, the DB don't have this value.
  2. before #12844 the value of LocalPathsOrder don't use for display recent_project, so we don't find the empty display in recent_project.
  3. after #12844, this value is used. But Users DB data don't have this data before #11504 release, so query empty. when using this data for display recent_project, it will display empty as #16119.

@SomeoneToIgnore

And, If you also think this UX don't need fix, I think this PR can closed.

CharlesChen0823 avatar Aug 22 '24 12:08 CharlesChen0823

I believe that we need to fix blank entries shown in the list, but do that the correct way.

SomeoneToIgnore avatar Aug 22 '24 12:08 SomeoneToIgnore

Reading the last comment a few times, I start to understand that the issue is with the fact that old code had spoiled the DB and now the new code reads it incorrectly?

That changes things indeed, we are not doing any data migrations right now IIRC.

SomeoneToIgnore avatar Aug 22 '24 12:08 SomeoneToIgnore

yes, the old code serialized data into DB don't have this column data, when the new code query result is empty.

CharlesChen0823 avatar Aug 22 '24 12:08 CharlesChen0823

Thank you for the explanations. It would save a lot of time on the decision-making if was put as a description in the PR.

In this particular case, let's close the issue indeed: I'll think of an SQL command to clean the odd database state and post into that issue. The problematic code existed in a few versions for a limited amount of people, is not very widespread — and clearing recent projects list have to be a build-in functionality anyway.

SomeoneToIgnore avatar Aug 22 '24 13:08 SomeoneToIgnore