Zaid-Ajaj / Feliz

A fresh retake of the React API in Fable and a collection of high-quality components to build React applications in F#, optimized for happiness
https://zaid-ajaj.github.io/Feliz/
MIT License
540 stars 78 forks source link

Plugin Feliz.HookAttribute expects v3.0 but currently running Fable v4.0.0-snake-island-alpha-009 #485

Closed nojaf closed 1 year ago

nojaf commented 2 years ago

Hello Zaid! I was curious about Fable 4 and I was bumping all my tools/packages inside my sample project. Turns out I can't use [<ReactComponent>] with the latest alpha?

.\src\fable_modules\Feliz.1.64.0\React.fs(1,1): error EXCEPTION: Plugin Feliz.HookAttribute expects v3.0 but currently running Fable v4.0.0-snake-island-alpha-009
   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1439.Invoke(String message) in C:\Users\alfon\repos\fsharp\src\fsharp\FSharp.Core\printf.fs:line 1439
   at Fable.CompilerExt.Compiler-ApplyPlugin@150.Invoke(Input input, Attribute att) in C:\Users\alfon\repos\Fable\src\Fable.Transforms\Global\Compiler.fs:line 156
   at Microsoft.FSharp.Collections.SeqModule.Fold[T,TState](FSharpFunc`2 folder, TState state, IEnumerable`1 source) in C:\Users\alfon\repos\fsharp\src\fsharp\FSharp.Core\seq.fs:line 731
   at Fable.CompilerExt.Compiler.ApplyMemberCallPlugin(Compiler com, MemberFunctionOrValue memb, Expr expr) in C:\Users\alfon\repos\Fable\src\Fable.Transforms\Global\Compiler.fs:line 166
   at Fable.Transforms.FSharp2Fable.Util.makeCallWithArgInfo(IFableCompiler com, Context ctx, FSharpOption`1 r, Type typ, FSharpOption`1 callee, FSharpMemberOrFunctionOrValue memb, CallInfo callInfo) in C:\Users\alfon\repos\Fable\src\Fable.Transforms\FSharp2Fable.Util.fs:line 2215
   at Fable.Transforms.FSharp2Fable.Util.makeCallFrom(IFableCompiler com, Context ctx, FSharpOption`1 r, Type typ, FSharpList`1 genArgs, FSharpOption`1 callee, FSharpList`1 args, FSharpMemberOrFunctionOrValue memb) in C:\Users\alfon\repos\Fable\src\Fable.Transforms\FSharp2Fable.Util.fs:line 2220
   at Fable.Transforms.FSharp2Fable.Compiler.transformExpr@731-42.Invoke(Context ctx) in C:\Users\alfon\repos\Fable\src\Fable.Transforms\FSharp2Fable.fs:line 731
   at MonadicTrampoline.run[a](Thunk`1 _arg1) in C:\Users\alfon\repos\Fable\src\Fable.Transforms\MonadicTrampoline.fs:line 8
   at Fable.Transforms.FSharp2Fable.Compiler.transformMemberFunction(IFableCompiler com, Context ctx, Boolean isPublic, String name, String fullDisplayName, FSharpMemberOrFunctionOrValue memb, FSharpList`1 args, FSharpExpr body) in C:\Users\alfon\repos\Fable\src\Fable.Transforms\FSharp2Fable.fs:line 1289

Is there any real restriction here? Or is the check of https://github.com/Zaid-Ajaj/Feliz/blob/295162276825b6e17cd8caac5d3f7ba8bc151ff8/Feliz.CompilerPlugins/ReactComponent.fs#L14 not taking alpha versions into account?

nojaf commented 2 years ago

Hmm, looks that way

https://github.com/fable-compiler/Fable/blob/dacbb6b51157ae01cbba3c835e0dd19e13b5dbdf/src/Fable.Transforms/Global/Compiler.fs#L79-L96

@alfonsogarciacaro any thoughts on this?

alfonsogarciacaro commented 2 years ago

@nojaf Plugins are not compatible yet, because they depend on the internal AST and this has changed with the major version. Once the AST settles (probably soon) we'll update the plugins :)

BTW, there are currently no changes for JS (besides JSX support, but this still needs to be tuned up for React) so it's no necessary to update your JS projects yet. I'm still pushing Fable 3 releases with any JS-related fix 👍

nojaf commented 2 years ago

Hey, thanks for clarifying this. I'll stick to the stable bits.

Zaid-Ajaj commented 1 year ago

@nojaf See #535