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

chore: update to fresh@1.2.0 #274

Merged
merged 8 commits into from
Jun 22, 2023
Merged

Conversation

brunocorrea23
Copy link
Contributor

#260

For some reason when I updated fresh version to 1.2, the button on the island VoteButton.tsx stopped working. I had to remove the disabled={!IS_BROWSER}. Doesn't seem to have any impact.

Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

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

Thanks for this. Can you please run the upgrade script using deno run -A -r https://fresh.deno.dev/update .? We also want to ensure we take advantage of all the new features. Some ones that we should probably include are:

  1. feat: add PageProps to _app fresh#1229 (possibly)
  2. feat: support passing signals as island props fresh#757

@brunocorrea23
Copy link
Contributor Author

makes sense. let me investigate these two new features and try to use them.

@iuioiua
Copy link
Contributor

iuioiua commented Jun 21, 2023

Cool. Hopefully, adding these in makes things easier/better. If that's not the case, feel free to leave them out.

@brunocorrea23
Copy link
Contributor Author

brunocorrea23 commented Jun 22, 2023

@iuioiua , can you check if this last commit makes sense?
I basically created an _app.tsx wrapper, added the Layout component to it and removed the Layout component from the specific routes.

For the feature that allows sharing signals between islands: not sure if this is useful here so far. We only have the VoteButton.tsx island and I couldn't see much advantage in having signals being passed via props there. What do you think?

Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

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

Oh, this is looking nice. Thoughts:

  1. import Layout from "@/components/Layout.tsx"; can be removed from all routes, except _app.tsx.
  2. Having ctx.state in most instances of ctx.render() is no longer needed. This will need to be validated on a case-by-case basis.

@@ -17,7 +17,7 @@ export default function PageSelector(
max={props.lastPage}
value={props.currentPage}
// @ts-ignore: this is valid HTML
onchange="this.form.submit()"
onchange={(e) => this.form.submit()}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
onchange={(e) => this.form.submit()}
onchange={() => this.form.submit()}

If the event parameter isn't used, it can be omitted.

routes/_app.tsx Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Niiiiiice

twind.config.ts Outdated
@@ -1,6 +1,6 @@
// Copyright 2023 the Deno authors. All rights reserved. MIT license.
import { Options } from "$fresh/plugins/twindv1.ts";
import { defineConfig, Preset } from "twind";
import { defineConfig, Preset } from "https://esm.sh/@twind/core@1.1.3";
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please revert? I don't think this is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you please confirm this here?
I needed to change this because once I upgraded fresh to 1.2, defineConfig and Preset were not defined in "twind" anymore.
This guide here (https://fresh.deno.dev/docs/examples/using-twind-v1) also imports defineConfig from core@1.1.3

@brunocorrea23
Copy link
Contributor Author

  1. Having ctx.state in most instances of ctx.render() is no longer needed. This will need to be validated on a case-by-case basis.

If we remove the ctx.state, the sessionId doesn't get passed to the _app.tsx and the Layout component doesn't change as it is supposed to change (when the user is logged in, show 'account' in the navbar)

@iuioiua iuioiua changed the title update fresh version to 1.2 chore: update to fresh@1.2.0 Jun 22, 2023
Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

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

I've made a couple of tweaks, and now, LGTM! I'll land merge as-is now. I've asked whether creating the signal within the component or island is best. I'll make an issue if we should proceed with that or not.

Thanks for this, @brunocorrea23!

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