Skip to content

Version 0.11.0-rc.2 #72

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

Merged
merged 1 commit into from
Oct 21, 2022
Merged

Version 0.11.0-rc.2 #72

merged 1 commit into from
Oct 21, 2022

Conversation

cknitt
Copy link
Member

@cknitt cknitt commented Oct 21, 2022

No description provided.

@cknitt cknitt requested a review from cristianoc October 21, 2022 06:10
@cknitt cknitt merged commit e4e3080 into master Oct 21, 2022
@cknitt cknitt deleted the 0.11.0-rc.2 branch October 21, 2022 07:53
@cristianoc
Copy link
Contributor

@mattdamon108 how about another round of testing, with compiler and rescript-react both rc.2
That should be the only thing left for the 10.1 compiler

@mununki
Copy link
Member

mununki commented Oct 21, 2022

Sure, I'll run tests and share the result. 1) v3 backward compatibility 2) v4 classic & automatic.
I'm going to focus on the test of v3 backward compatibility.

@cristianoc
Copy link
Contributor

Sure, I'll run tests and share the result. 1) v3 backward compatibility 2) v4 classic & automatic.
I'm going to focus on the test of v3 backward compatibility.

Great, then we can ask again on the forum, with simplified instructions now that everything is published to npm.

@mununki
Copy link
Member

mununki commented Oct 21, 2022

deps

package.json

"@rescript/react": "^0.11.0-rc.2",
"rescript": "^10.1.0-rc.2",

V3

bsconfig.json

"jsx": {
    "version": 3,
    "v3-dependencies": [
      "rescript-relay"
    ]
  }
"bsc-flags": [
    "-open ReactV3"
  ]

I've tested on the current production project, it builds successfully without any code change.


V4 classic & automatic

"jsx": {
    "version": 4,
  }

Everything seems fine, except for the below breakings in the case of a component key.

let key = Some("k")
let _ = <C ?key /> // option<string> vs. string

@mununki
Copy link
Member

mununki commented Oct 21, 2022

Side comment: there would be dependencies that are not supported in v4, it would break it.
For example, having a React.Context.Provider component or using old React binding e.g. ReactDOM.Experimental

@cristianoc
Copy link
Contributor

Why should the type of 'key' change?
Is that by design, or just a consequence of how things are set up?

@mununki
Copy link
Member

mununki commented Oct 21, 2022

https://github.com/rescript-lang/rescript-react/blob/master/src/React.res#L17:L21
If change the k: option<string>, then it gets worse.

let _ = <C key=Some("k") />

@cristianoc
Copy link
Contributor

Isn't key a special case in the ppx already? By treating it as a special prop it should be possible to make it type string.

@mununki
Copy link
Member

mununki commented Oct 21, 2022

%%private(
  @inline
  let addKeyProp = (p: 'props, ~k: option<string>=?): 'props =>
    switch k {
    | Some(k) =>
      Obj.magic(Js.Obj.assign(Obj.magic(p), {"key": k}))
    | None => p
    }
)

How about this?

@cristianoc
Copy link
Contributor

If it removes the breaking change, it sounds good.
Was ?key possible in V3, or does it become a new possibility?

@mununki
Copy link
Member

mununki commented Oct 21, 2022

Was ?key possible in V3, or does it become a new possibility?

Yes, it was possible.

@mununki
Copy link
Member

mununki commented Oct 21, 2022

%%private(
  @inline
  let addKeyProp = (p: 'props, ~k: option<string>=?): 'props =>
    switch k {
    | Some(k) =>
      Obj.magic(Js.Obj.assign(Obj.magic(p), {"key": k}))
    | None => p
    }
)

How about this?

It works well. I'll make a PR.

@mununki
Copy link
Member

mununki commented Oct 21, 2022

#74

@mununki
Copy link
Member

mununki commented Oct 22, 2022

rescript-lang/syntax#693

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.

3 participants