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

Component doesn't react to prop changes #698

Open
frenicohansen opened this issue Feb 20, 2025 · 0 comments
Open

Component doesn't react to prop changes #698

frenicohansen opened this issue Feb 20, 2025 · 0 comments

Comments

@frenicohansen
Copy link

Description
I've noticed that the component doesn't update when the parent passes new values for the planSource and planQuery props. The parsing and initialization logic is executed inside the onBeforeMount hook, which only runs once during the component’s lifecycle. This means that even if the parent updates these props later, the component's internal state (like queryText) is not re-computed.

Is the current behavior (processing props only on mount) intentional? If not, I'll work on a PR that makes the component reactive to prop changes.

To Reproduce

  1. Render the component with initial props for planSource and planQuery.
  2. Update these props from the parent component.
  3. Observe that the component does not re-render or re-parse the new values.

Expected behavior
The component should be reactive to changes in planSource and planQuery.

Current Workaround
At the moment, the only way to force the component to re-render with new prop values is by passing a different key from the parent component. This forces a remount of the component, triggering the initialization logic again.

Example: https://github.com/commandprompt/pgmanage/blob/master/pgmanage/app/static/pgmanage_frontend/src/components/ExplainTabContent.vue

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

No branches or pull requests

1 participant