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

[bug]: Custom Field Functions in Dev Mode but Fails in Start Mode #29

Open
burakozdemir32 opened this issue Jul 23, 2024 · 0 comments
Open
Labels
issue: bug Issue reporting a bug severity: medium If it breaks the basic use of the product but can be worked around source: sdk-plugin

Comments

@burakozdemir32
Copy link

burakozdemir32 commented Jul 23, 2024

What version of @strapi/blocks-react-renderer are you using?

Node.js version: 18.17.0
NPM version: yarn/1.22.19
Strapi version: 5.0.0-rc.5
Database: sqlite
Operating system: darwin-arm64
Is your project Javascript or Typescript: Typescript
Plugin language: Typescript

What's Wrong?

The custom field works in dev mode but fails in start mode due to the useField hook not being able to find the Form context. This error (Uncaught Error: The Form Component has not been initialised, ensure you are using this hook within a Form component) indicates that the Form component or context provider is not properly initialized in start mode. This discrepancy often arises from differences in the build or initialization process between development and production environments.

To Reproduce

Add a custom field using the latest (5.0.1) plugin generator and try to use the useField helpers in both dev and start modes. In dev mode, everything works as expected. However, in start mode, you encounter the following error:

Uncaught Error: The Form Component has not been initialised, ensure you are using this hook within a Form component

This indicates that while the custom field functions correctly in dev mode, it fails in start mode due to the Form component or context not being properly initialized.

Expected Behaviour

No errors regarding custom field.

@burakozdemir32 burakozdemir32 added the issue: bug Issue reporting a bug label Jul 23, 2024
@burakozdemir32 burakozdemir32 changed the title [bug]: Custom Field Works on Dev Mode But Not On Start [bug]: Custom Field Functions in Dev Mode but Fails in Start Mode Jul 23, 2024
@hanpaine hanpaine added severity: medium If it breaks the basic use of the product but can be worked around source: sdk-plugin labels Jul 30, 2024
@github-project-automation github-project-automation bot moved this to To be reviewed (Open) in Developer Experience Squad Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug severity: medium If it breaks the basic use of the product but can be worked around source: sdk-plugin
Projects
Status: To be reviewed (Open)
Development

No branches or pull requests

2 participants