Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input specific propType source #75

Merged
merged 53 commits into from
Sep 26, 2022
Merged

Conversation

jspolancor
Copy link
Contributor

@jspolancor jspolancor commented Mar 10, 2022

  • Creates the createFormPropertySource() function and adds it to the global property sources
  • Creates tests cases for createFormPropertySource()
  • Creates stories for createFormPropertySource()

Notes:
This is a WIP PR, there's a few things that I don't fully understand and need feedback about

  1. I had to change the type PropTypeInfo and set name as optional, because for the form propType source it can be optional, without changing that it was imposible to create an unnamed source, this change forced me to update the other ...PropertySource() functions, adding a ! at the end of propInfo.source.name, all tests are passing but I'm not 100% sure about this type change
  2. As there are too many conditions and special cases, inside createFormPropertySource() I created one function for every major case, and then using the flow function from lodash I call them all one by one, flow is just a pipe
  3. I haven't touched the docs yet, I know for sure many files need to be updated, but I don't have a full understanding of all the doc files yet, @ThaNarie could you please make me a list of all the files that need to be updated? that would be super useful!
  4. Regarding <input type="file"/>, I added a function inside createFormPropertySource() to check for file inputs, but testing it I realized it's not very useful... because it is impossible to set the value of an input file directly, so initially when setting the prop the value will be undefined, so from the rendered HTML from a CMS we cannot get an initial value... It's working, but I don't fully understand how we could use it in an app, i will rather just bind a change event to the input

I think that's it, please let me know your thoughts

@jspolancor jspolancor linked an issue Mar 10, 2022 that may be closed by this pull request
Copy link
Contributor

@ThaNarie ThaNarie left a comment

Choose a reason for hiding this comment

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

Not checked everything yet, but here are some initial comments :)

src/lib/props/property-sources/createFormPropertySource.ts Outdated Show resolved Hide resolved
src/lib/props/propDefinitions.types.ts Outdated Show resolved Hide resolved
@ThaNarie
Copy link
Contributor

I had to change the type PropTypeInfo and set name as optional ...

That's strange, I will need to look at that (commented the same)

As there are too many conditions and special cases, inside createFormPropertySource() I created one function for every major case, and then using the flow function from lodash I call them all one by one, flow is just a pipe

That's fine, I added a comment on the usage of pipe itself though :)

I haven't touched the docs yet, I know for sure many files need to be updated, but I don't have a full understanding of all the doc files yet, @ThaNarie could you please make me a list of all the files that need to be updated? that would be super useful!

I think just these two:

Regarding <input type="file"/> ...

Jep you're right, this doesn't make much sense. I would leave it out – and only add it back if someone finds a reason to use it :)

@jspolancor
Copy link
Contributor Author

I had to change the type PropTypeInfo and set name as optional ...

That's strange, I will need to look at that (commented the same)

As there are too many conditions and special cases, inside createFormPropertySource() I created one function for every major case, and then using the flow function from lodash I call them all one by one, flow is just a pipe

That's fine, I added a comment on the usage of pipe itself though :)

I haven't touched the docs yet, I know for sure many files need to be updated, but I don't have a full understanding of all the doc files yet, @ThaNarie could you please make me a list of all the files that need to be updated? that would be super useful!

I think just these two:

Regarding <input type="file"/> ...

Jep you're right, this doesn't make much sense. I would leave it out – and only add it back if someone finds a reason to use it :)

Docs were updated 📝

src/lib/props/property-sources/createFormPropertySource.ts Outdated Show resolved Hide resolved
src/lib/props/property-sources/createFormPropertySource.ts Outdated Show resolved Hide resolved
docs/api/props.md Outdated Show resolved Hide resolved
docs/api/props.md Outdated Show resolved Hide resolved
docs/guide/props.md Show resolved Hide resolved
docs/guide/props.md Show resolved Hide resolved
src/lib/props/property-sources/createFormPropertySource.ts Outdated Show resolved Hide resolved
docs/guide/props.md Show resolved Hide resolved
@jspolancor jspolancor requested a review from ThaNarie May 5, 2022 20:00
src/lib/props/property-sources/createFormPropertySource.ts Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@jspolancor jspolancor requested a review from ThaNarie May 26, 2022 15:21
@jspolancor jspolancor requested a review from ThaNarie May 31, 2022 15:44
CHANGELOG.md Outdated Show resolved Hide resolved
@ThaNarie ThaNarie merged commit 3cbc011 into next Sep 26, 2022
@ThaNarie ThaNarie deleted the feature/input-prop-type-source branch September 26, 2022 15:51
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.

Add input-specific propType.source type
2 participants