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

General feedback about Strapi 5 support #434

Open
olrtg opened this issue Oct 10, 2024 · 14 comments
Open

General feedback about Strapi 5 support #434

olrtg opened this issue Oct 10, 2024 · 14 comments
Labels
question Further information is requested

Comments

@olrtg
Copy link
Contributor

olrtg commented Oct 10, 2024

I'm creating this general issue to collect some feedback from other people about the work done in past PRs to support Strapi 5 and how we can improve it. If you want it, maybe I create separate issues to track these individually.

After installing the module myself and using v5 for a while in a personal project I've found the following:

  • Maybe It'll be good to document that if people want to try v5 out, aside from switching to the edge version, they should also set the version manually in the nuxt.config.ts file:
    export default defineNuxtConfig({
      strapi: {
        version: 'v5',
      },
    })
  • For some reason, if you pass an interface instead of a type as the generic type of the useStrapi<T>() composable it will not give you the correct types. This didn't happen to me on the v4 composable and I don't even know if this is fixable (because it seems to be a TS thing) but I guess at least we should tell people to use types instead of interfaces in the docs, or even better, try to find a workaround. In my opinion, users should not be bothered with this and they should be able to use both if they want. I've created a small repro here: https://tsplay.dev/WYxeQm.
  • If I do a find request to a collection to query all elements, the locale key has a null value, which differs from the current type locale?: string, I think it should be locale?: string | null instead:
    Image

For now, that's what I've found. Let me know what you think!

Related PRs:

@olrtg olrtg added the question Further information is requested label Oct 10, 2024
@reslear
Copy link
Contributor

reslear commented Oct 15, 2024

  1. maybe
  2. same
  3. agree

also need export StrapiLocale for setting out request
instead types error import type { StrapiLocale } from '@nuxtjs/strapi/dist/runtime'

@BayBreezy
Copy link
Contributor

  1. Yes, the fact that v5 is not the default should be somewhere in the docs. Could be tricky as the default version of Strapi is now 5. The module has not been fully tested for v5.
  2. I am no TS expert so I am not even sure how to approach this 🤣. That is a weird one tho. Why would types work and not interfaces?
  3. Correct! locale can be null.

@reslear would the StrapiLocale be a composable? Not sure what you mean there.

@benjamincanac
Copy link
Member

As you guys might know, I'm not actively maintaining this repository. Would you mind telling me once everything is good so I can release a major version?

@reslear
Copy link
Contributor

reslear commented Oct 16, 2024

✅ 1, 3 - fixed

  1. i was thinking maybe we could just do it like v4 without generics ?
    like data | data []

  2. I'm also thinking of exporting types like

    import type { StrapiLocale } from '#nuxt-strapi/types';
  3. I also keep the same types between projects, I suggest adding StrapiDynamicZone, StrapiComponent, StrapiImage, StrapiSeo.

  4. For dynamic editor I suggest to add information about

@olrtg
Copy link
Contributor Author

olrtg commented Oct 16, 2024

@reslear 2 sounds great to me. About the other points idk. I just started using this module and Strapi, so I don't know much yet.

@Zellokr
Copy link

Zellokr commented Oct 17, 2024

Hi guys, I'm trying to use useStrapi module (V5), nuxt can't find useStrapi, however I can use useStrapiUser, UseStrapiToken, useStrapiAuth, etc... do you know why?

Copy link
Member

@Zellokr Do you use the latest Edge version?

@Zellokr
Copy link

Zellokr commented Oct 17, 2024

Yes, as devDepencencies Image

Copy link
Member

Could you try npm:@nuxtjs/[email protected] (latest release), sometimes the latest tag don't work that well.

@Zellokr
Copy link

Zellokr commented Oct 17, 2024

It works, however type error "V5" in nuxt.config.ts still appears.

Thank you! :)

@MarijnFK
Copy link

MarijnFK commented Oct 23, 2024

✅ 1, 3 - fixed

  1. i was thinking maybe we could just do it like v4 without generics ?
    like data | data []

  2. I'm also thinking of exporting types like
    import type { StrapiLocale } from '#nuxt-strapi/types';

  3. I also keep the same types between projects, I suggest adding StrapiDynamicZone, StrapiComponent, StrapiImage, StrapiSeo.

  4. For dynamic editor I suggest to add information about

  1. sounds great. With the latest i can't import any types from "@nuxtjs/strapi", i.e. import type { Strapi4ResponseData } from "@nuxtjs/strapi"; This did work in strapi v4, but seems broken now.

@derrickmehaffy
Copy link

Stopping by here from the Strapi team (as I work for Strapi) to mention that if anyone needs any information clarity on how something works or help maintain or build support for Strapi 5 please don't hesitate to stop by our Discord: https://discord.strapi.io

Or if you are in dire need of some information for this module you can email me directly: [email protected] (please don't send emails asking for normal application support but if it's related to this module then it's all good).

Thanks!

Copy link
Member

Just released a v2.0.0, let me know if you encounter any issue with it!

@BayBreezy
Copy link
Contributor

Okie! Will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants