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

Try no ids #858

Draft
wants to merge 2 commits into
base: fortuna-cloud
Choose a base branch
from
Draft

Try no ids #858

wants to merge 2 commits into from

Conversation

fortuna
Copy link
Collaborator

@fortuna fortuna commented Mar 24, 2021

This PR illustrates how we could do most of the app logic without IDs. It's not for review, but as a study.

I'm effectively using the account and server objects as the "ids". You can do lookups by scanning and doing equality comparisons, but not indexed lookups.

Scanning instead if indexing can be a performance issue, but in practice it doesn't matter in this case. However I still ran into 2 major issues:

  1. getServerView expects an ID
  2. We need a persistent ID for LAST_DISPLAYED_SERVER_STORAGE_KEY

It's possible to work around # 1 by either scanning the DOM tree, or by properly doing attribute binding with the serverList. Instead of looking up the server view, we should be setting the properties on the serverList instead.

Issue # 2 requires a persistent ID that survives restarts, so we can't use the objects as identity. Therefore we can't get away from using stable IDs. We could use random ids for the objects, like we do in the client, but that would require persisting the random ids. Instead, we can compose persistent IDs without persisting them by combining the account uuid and the droplet id, as I do on #852.

@google-cla google-cla bot added the cla: yes label Mar 24, 2021
@fortuna fortuna mentioned this pull request Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant