Skip to content

Allow project saving method to be configured #4606

@paulkaplan

Description

@paulkaplan

Currently project saving is handled in GUI/project-saver-hoc, which basically does the following on a save:

  1. Use storage.store on all dirty assets
  2. Use xhr module to POST/PUT against storage.projectHost/projectId
    • The storeProject function is called with request params like title, is_remix, is_original depending on if it is creating a new project, remixing, copying, etc.
    • Expects {id: projectId} in response
  3. Use (passed in) props.onUpdateProjectThumbnail(projectId, thumbnailBlob) to update the thumbnail

Step 3 is easily configurable externally. I believe step 1 can be configured by customizing a storage helper to do this (although I haven't tried it, so not 100% on this). But step 2 is not configurable.

Depending on how we want this to look in the future, we could do a few things to make project saving more configurable.

  1. Use scratch-storage to store project JSON, so it can be configured the same way asset saving can be configured. There is a consistency to this, but project JSONs would be pretty different to save on the web because of authentication, so might be a fair bit of work that wouldn't really be used elsewhere.
  2. Add a onUpdateProjectData (or similar) prop that can be called that acts like this promise. Then www can pass in that same function, but other consumers of GUI can handle project data saving differently.
  3. ... other ideas?

/cc @rschamp @chrisgarrity @cwillisf since you probably have thoughts on the approach for this.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions