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

The isActive config is ignored when updated dynamically #143

Open
DannyFeliz opened this issue Nov 8, 2019 · 2 comments
Open

The isActive config is ignored when updated dynamically #143

DannyFeliz opened this issue Nov 8, 2019 · 2 comments
Assignees

Comments

@DannyFeliz
Copy link

DannyFeliz commented Nov 8, 2019

I'm trying to disable the behavior of the click outside dynamically by changing the isActive property of the config object but the behavior still the same.

I know I can use the middleware to handle this (check line 36) but I don't know if the config of click outside expects to be dynamically.

https://codesandbox.io/s/v-click-outside-e4vin

@ndelvalle
Copy link
Owner

Thanks for the codesanbox example @DannyFeliz !

As a workaround, you can use a computed property that returns a new object whenever your configuration changes and use this computed in the directive. At the moment vuejs marks the directive new and old object as the same object on the update hook 😓 I guess I can store the config and compare it my self on the directive instead of relying on these attributes.

  computed: {
    conf() {
      return Object.assign({}, this.config)
    },
  },

@ndelvalle ndelvalle self-assigned this Nov 8, 2019
@ndelvalle ndelvalle added the bug label Nov 8, 2019
@DannyFeliz
Copy link
Author

DannyFeliz commented Nov 8, 2019

Thanks for the suggestion, but what I'm going to do for now is just leave isActive always true and use the middleware approach instead.

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

No branches or pull requests

2 participants