Skip to content

Conversation

@samueljim
Copy link

@samueljim samueljim commented May 24, 2021

@jamesrplee The main.ts file now defines a set of default values that will be used when an input is missing.
This means that if the input isn't passed in then the value here will be used.

For example, this request is saying to hide logos but it will use the default title as there is no value passed in. The way there is no undefined string printed as there is always a fallback value.
https://cdn.make.cm/make/t/439a758e-3335-48b3-a923-c8ffccb702c4/k/6f1e51fd-dac7-468a-b73c-33092bfc0150.a797e51d472c0d6c32517d5edb7f2907/sync?size=A4&format=pdf&data[showLogos]=false

@samueljim
Copy link
Author

I can make the same automatic build and default value change for the other example repos if you think this is a good change

Copy link
Contributor

@jamesrplee jamesrplee left a comment

Choose a reason for hiding this comment

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

A few questions in there @samueljim.

The bigger question I have is, whether we want default values at all in the boilerplate? Or whether we just run a conditon on the inputs that if null we remove the element. For these templates that would make more sense.

Another option is we leave them in there but comment them out so that the end user can decide whether to use them or not. I just don't want to devs to feel like they have to use default values if the API returns null.

What do you think?

"start": "sirv public",
"validate": "svelte-check"
},
"pre-commit": [ "validate", "build" ],
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need pre-commit as a dependency? What's it offering for the boilerplate?


// You can define default input values here. The values here will be used if no value is given.
const inputs = {
...{
Copy link
Contributor

Choose a reason for hiding this comment

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

Defining an object and then instantly spreading it seems a bit dank. Couldn't we just do?

const props = {
  foo: 'bar',
   ...window.templateProps
}

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants