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

Examples from 0.3.x included in docs for 0.2.x #60

Closed
adundovi opened this issue Oct 10, 2021 · 8 comments
Closed

Examples from 0.3.x included in docs for 0.2.x #60

adundovi opened this issue Oct 10, 2021 · 8 comments

Comments

@adundovi
Copy link
Contributor

adundovi commented Oct 10, 2021

The second app from (stable) docs does not compile. The reason for it seems like the wrong code snippets are included (those from 0.3.x, not 0.2.x). For example, in the 5th snippet one has RenderFnResultWithCause while in the text it is not mentioned at all (I presume StringResultWithCause is an old name for it).

To Reproduce
Steps to reproduce the behavior:

  1. Follow the tutorial (stable) for the second app
  2. c/p the code from the snippets
  3. perseus serve throws a bunch of errors

Expected behavior
I expect that the example compiles as described :-)

Actual result

error[E0432]: unresolved import `perseus::template::RenderFnResultWithCause`
 --> src/templates/index.rs:3:18
  |
3 |     GenericNode, template::RenderFnResultWithCause, Template,
  |                  ^^^^^^^^^^-----------------------
  |                  |         |
  |                  |         help: a similar name exists in the module: `StringResultWithCause`
  |                  no `RenderFnResultWithCause` in `template`

(...)

error[E0282]: type annotations needed
  --> src/templates/index.rs:41:5
   |
41 |     Ok(serde_json::to_string(&IndexPageProps {
   |     ^^ cannot infer type for type parameter `E` declared on the enum `Result`

error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
  --> src/templates/index.rs:24:25
   |
24 |         .build_state_fn(Rc::new(get_build_props))
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^ expected function that takes 1 argument
...
40 | pub async fn get_build_props(_path: String, _locale: String) -> RenderFnResultWithCause<String> {
   | ----------------------------------------------------------------------------------------------- takes 2 arguments
   |
   = note: required because of the requirements on the impl of `GetBuildStateFnType` for `fn(std::string::String, std::string::String) -> impl Future {get_build_props}`
   = note: required for the cast to the object type `dyn GetBuildStateFnType`

Environment (please complete the following information):

  • Perseus Version: v0.2.3
  • Sycamore Version: v0.6.1
  • OS: Linux
@arctic-hen7
Copy link
Member

Ah. v0.3.0 will go stable tomorrow, so I'd advise upgrading for now, but that is a very clear problem in the docs that needs solving! Thanks for the report!

@arctic-hen7
Copy link
Member

This will require getting previous version of files with git show programmatically, which I'll set up tomorrow, it's certainly necessary to do.

@adundovi
Copy link
Contributor Author

Great! I didn't look up how the docs are generated, so I don't have suggestions how to fix it.

arctic-hen7 added a commit that referenced this issue Oct 10, 2021
…th problems

Also added warning to readme about invalid examples for older versions as per #60.
@arctic-hen7
Copy link
Member

For some reason this isn't building correctly. Reopening until I've figured that out.

@arctic-hen7 arctic-hen7 reopened this Oct 10, 2021
@arctic-hen7
Copy link
Member

Okay, this was easily fixed by making the Checkout action copy in the whole Git history with fetch-depth: 0, rather than its default behavior of copying in only parts. The website now compiles both locally and on CI, and I believe this issue is resolved!

@arctic-hen7
Copy link
Member

Also, I feel I should add to this that saying v0.3.0 would be stabilized today was incorrect (sorry!), that was before the plugins system was scheduled for that release, so it'll be a little while before it goes stable. See #58 for details. That said, v0.3.0 is perfectly usable in beta form.

@adundovi
Copy link
Contributor Author

Also, I feel I should add to this that saying v0.3.0 would be stabilized today was incorrect (sorry!)...

OK, no problem. At the moment, I'm just experimenting, so switching from v0.2.x to v0.3.0 shouldn't be a problem.

Regarding plugins, if I plan to use perseus serve to generate CSS in static via tailwindcss, should that fall into the Type 3 plugins? (sorry for off topic)

@arctic-hen7
Copy link
Member

Right now, that's ambiguous, because that'd be setup/teardown code (rather than modifying any existing Perseus behavior), but it would either be type 1 or type 2. Likely type 1.

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

No branches or pull requests

2 participants