decentraland / decentraland/creator-hub
move scene.json data inside Project type
- Dominant language
- TypeScript
- Stars
- 7
- Forks
- 14
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 44
Description
### Problem:
We are currently spreading props from `scene.json` into the `Project` type to provide info about the project + scene. The problem with this approach is that whenever the `scene.json` get's updated, we need to map those updates to the Project type.
Example:

This is a bug prone approach since forgetting to map a prop will leave the in-memory Project outdated.
### Solution:
Change `Project` type to include the whole `Scene` type as `{ ...project, scene: Scene }`, and replace all the current scene.json-based props from `Project` type with getter functions so we avoid duplicating data as we do now.
By replacing current scene.json-based props I mean props like `title`, which is an alias for `scene.display?.title`, etc. Those props can instead be a `getTitle` function that returns `project.scene.display?.title || 'Some default'`.
So if an update happens to the `scene.json` file, then for updating the in-memory project and have everything in-sync this will be enough:

Contributor guide
Assessment
This issue has not been assessed yet.