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

forceUpdate in documentation #1061

Closed
Slevinski opened this issue Mar 12, 2023 · 1 comment · Fixed by #1352
Closed

forceUpdate in documentation #1061

Slevinski opened this issue Mar 12, 2023 · 1 comment · Fixed by #1352

Comments

@Slevinski
Copy link

With v3, it seems forceUpdate has been mostly removed from the documentation.

I did find it on https://stenciljs.com/docs/api#other but the documentation is sparce.

I'm not sure the best update to the documentation, but two points should be made.

  • In order to use forceUpdate in a component, you need to import it from @stencil/core.
  • In order to call forceUpdate on a component, you need to pass it a reference to a node or element.

For a class component, I used something like the following.

import { Component, forceUpdate } from '@stencil/core'

// inside a class component function
forceUpdate(this);

I know that forceUpdate isn't the best solution for production, but it is useful in development and testing.

@rwaskiewicz
Copy link
Member

Thanks! I've labeled this for the team to look into

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants