Skip to content
This repository was archived by the owner on Apr 30, 2020. It is now read-only.

Conversation

@zolga
Copy link
Contributor

@zolga zolga commented Dec 24, 2019

Set initial HTML & CSS when remixing the app

@zolga zolga requested a review from vogre December 24, 2019 07:44
Copy link

@vogre vogre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I exported the editorPrefix and importing in handler - hope this is what you meant :)

@@ -0,0 +1,7 @@
export const initialData = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: '' }?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@zolga
Copy link
Contributor Author

zolga commented Jan 7, 2020

@vogre Thank you for your comments 👍
I export the prefix.
regarding the initial data template would love your help with that cause its not working in this project and im not sure why.

Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants