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

Internal server error: Code(20): Calling a 'use*()' method outside component$... #53

Closed
primozs opened this issue May 18, 2023 · 4 comments
Labels
duplicate This issue or pull request already exists

Comments

@primozs
Copy link

primozs commented May 18, 2023

The whole message is:
Internal server error: Code(20): Calling a 'use*()' method outside 'component$(() => { HERE })' is not allowed. 'use*()' methods provide hooks to the 'component$' state and lifecycle, ie 'use' hooks can only be called synchronously within the 'component$' function or another 'use' method. For more information see: https://qwik.builder.io/docs/components/tasks/#use-method-rules

and stack trace points to "placeholder attribute prop"
I am using "qwik-speak": "^0.13.0" but it started in previous versions.

<Input
     // this does not work any more
     placeholder={t('app.enterYourEmail@@Enter your email')}
/>`
`

but this is ok

`const inputPlaceholderMsg = t('app.enterYourEmail@@Enter your email');

<Input
   placeholder={inputPlaceholderMsg}
/>`
@robisim74
Copy link
Owner

See #50

@robisim74 robisim74 added the duplicate This issue or pull request already exists label May 18, 2023
@primozs
Copy link
Author

primozs commented May 19, 2023

I have read #50
I don't like the dx because you need to think where you are passing this "t" translate$ function.
Could we have useTranslate that would return inline translate without requirement to pass context.

something like
const {t} = useTranslate()

then use t('message') wherever.

@primozs
Copy link
Author

primozs commented May 19, 2023

Ok this could be done by user also

@primozs primozs closed this as completed May 19, 2023
@robisim74
Copy link
Owner

robisim74 commented May 19, 2023

@primozs Yes, I'm already working on the useTranslate solution - I just need to troubleshoot with Inlining and it will be released soon

@robisim74 robisim74 mentioned this issue May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants