Skip to content

Instantly share code, notes, and snippets.

@lynaghk
Last active March 20, 2022 20:19
Show Gist options
  • Select an option

  • Save lynaghk/977bbe804b5ffacccf2502ccefdfc077 to your computer and use it in GitHub Desktop.

Select an option

Save lynaghk/977bbe804b5ffacccf2502ccefdfc077 to your computer and use it in GitHub Desktop.
SketchSystems Frontend App*
SketchSystems Frontend App*
# Fired whenever the URL changes (e.g., browser's back/forward buttons are used, or if someone clicks a link in the UI to navigate to their profile, create a new sketch, etc.)
navigate -> Loading
Error
# All events from this state come from the server, which tells the frontend whether the user is logged in, if they own this sketch, etc.
Loading*
new logged in -> New Logged In
new logged out -> New Logged Out
yours logged in -> Yours Logged In
other logged in -> Other Logged In
other logged out -> Other Logged Out
user profile -> User Profile
error -> Error
# State which lists all of someone's sketches
User Profile
# State that shows editors/playground view
Editing
# There's an autosave internal transition here, w/ a guard that only allows it to fire when the user owns the sketch they're looking at.
# No way to encode those semantics right now.
# Autosave ->
# You logged in, making a new sketch
New Logged In
# The save button fires this event --- it's when you want to save your "new sketch" scratchpad into an actual sharable, URL.
save -> Loading
# Anon user making their own sketch (autosaves via browser session cookie)
New Logged Out
# You logged in, looking at one of your own sketches
Yours Logged In
# You logged in, looking at someone else's sketch
Other Logged In
# Anon looking at a sketch
Other Logged Out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment