rancher / dashboard

The Rancher UI
https://rancher.com
Apache License 2.0
441 stars 243 forks source link

Remove global `window.c` variable from Vue components #11311

Open rak-phillip opened 1 week ago

rak-phillip commented 1 week ago

Several components contain the following code in their mounted hooks:

mounted() {
  window.c = this;
}

This assigns the current vue component instance to a window.c variable. It's unclear as to why this was added to Dashboard and it's not a very good practice as global variables can be modified from anywhere in code.

Expected outcome

Additional information

Identified components using this pattern:

nwmac commented 3 days ago

@rak-phillip My guess is this was added for developer debugging - there were other cases like this that I have previously removed - it only appears to be written to, so I would go ahead and remove.

nwmac commented 3 days ago

At least the last 2 are new - @eva-vashkevich may have added these and might have more information.

eva-vashkevich commented 2 days ago

I am removing it from the drivers pages in my drivers fixes PR. Shouldn't have added it.