-
Notifications
You must be signed in to change notification settings - Fork 77
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
Basic account import #1347
Basic account import #1347
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review of the core PCD-handling logic, and some thoughts on the user experience. I didn't review the UI integration in detail.
This simple version is probably fine, though I raised some questions in comments to think about where it might cause confusing situations.
I think what I'll need for sync merge is going to be somewhat more complex than this. Depending on where things go from comments, this code converge with that need, or could be kept separate. I'm less concerned about duplicated effort than I was, because this code is less complex than I feared.
setImportState({ | ||
valid: true, | ||
imported: false, | ||
pcds, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is explicitly importing only PCDs, not subscriptions, and not other user data which is in the blob. I think that's a valid choice for this feature, though maybe different from what I want for sync merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - I'm not sure whether restoring subscriptions makes sense or not, or whether it would be a desirable feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends on whether the user sees this as importing a set of PCDs, or rolling back their account to a known good state. Feeds are likely not hard to reconstruct, but they are technically user data which could be lost in a conflict.
for (const pcd of importState.pcds) { | ||
if (!pcdCollection.hasPCDWithId(pcd.id)) { | ||
try { | ||
pcdCollection.add(pcd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works fine for import. Given I recently realized that PCD ordering is a user-visible piece of state, let me think through that here. This logic doesn't attempt to preserve PCD ordering but puts imported ones at the end of the folder order as if they were new. Doing otherwise would be complicated, so I'm not recommending it, just pointing it out.
I reviewed the latest changes and resolved one conversation based on it, but others remain TBD. |
7184178
to
9989899
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great! A few more suggestions inline. I also think you planned to investigate single-folder import before calling this done
|
||
this.addAll(pcds, { upsert: true }); | ||
|
||
// If the caller wants folders to be merged too |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not your fault, but it's super weird to me that setting folders is a separate operation from adding the PCDs. Should probably be unified into add/addAll someday.
da05221
to
d788104
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more things to consider or discuss.
collection: PCDCollection, | ||
pcdsToMergeIds: Set<PCD["id"]> | ||
) { | ||
const userHasExistingSemaphoreIdentityPCD = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if this filtering logic (special-case for identity, email, and the decision never to replace the same ID) were in a helper function defined once rather than duplicated both here and in the UI.
imported: pcds.getAll().length - pcdCountBeforeMerge | ||
} | ||
}); | ||
} catch (e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log the error to console. Actually in general a few console log statements in this function in normal path would be welcome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd still like to see some console logging in here, both for errors and normal cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping that this still remains to be done, though I'm not going to hold back the review just for logging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bug report
I exported pcds from one account, after having added a new eddsa signature pcd via consumer-client. then, I logged out, and logged in with a new account. attempting to import my pcds from the 1st account resulted in the following error:
However, after reloading the page, the eddsa signature PCD is indeed imported.
Opinions - everyone's got 'em, including me :3 Sorry to be so pedantic in my review, but it's what I think based on the information I have.
5f15edb
to
f399ff6
Compare
The modal is now a screen, which makes the UI nicer, and also removes the sync problem: sync only runs when you're on a screen with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested locally and it seemed to work.
<LinkButton $primary={true} to="/import" onClick={close}> | ||
Import Account Data | ||
</LinkButton> | ||
<Spacer h={16} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this spacer made a difference as the modal is still the same size for me. I wonder if its height is hard-coded somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the new functionality, but a few more requests to make on the latest state.
imported: pcds.getAll().length - pcdCountBeforeMerge | ||
} | ||
}); | ||
} catch (e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd still like to see some console logging in here, both for errors and normal cases.
|
||
/** | ||
* Merges another PCD collection into this one. | ||
* There are two options: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There aren't two of these anymore.
08dab73
to
148b7f5
Compare
148b7f5
to
f4b8dd9
Compare
Closes #1272