Conversation
vogre
left a comment
There was a problem hiding this comment.
Thanks!
Since we have the initial_template_data.json, I'm not quite sure why we need to duplicate it in constants.js? (This would only affect apps that remove the db entry, but I think in that case the defaults are better as blank?)
| export async function getHtmlFields() { | ||
| try { | ||
| const { html, css, js } = await get(editorPrefix); | ||
| const { html, css, js } = (await get(editorPrefix)) || initialData; |
There was a problem hiding this comment.
It looks like the code is repeating between backend/backend.js and backend/_handler.js - can it be extracted into a single location (e.g. so we don't define editorPrefix twice).
There was a problem hiding this comment.
I exported the editorPrefix and importing in handler - hope this is what you meant :)
| @@ -0,0 +1,7 @@ | |||
| export const initialData = { | |||
There was a problem hiding this comment.
Do we really need to repeat the initial data in constants.js? How about if someone deletes the entry what is returned an object that looks like { html: '', css: '', js: '' }?
There was a problem hiding this comment.
maybe I'm doing something wrong, but the initial data template did not work for me. both of the files are in the project - any ideas?
|
@vogre Thank you for your comments 👍 Thanks. |
Set initial HTML & CSS when remixing the app