lensapp / lens

Lens - The way the world runs Kubernetes
https://k8slens.dev/
MIT License
22.53k stars 1.47k forks source link

Elimination of global shared state #4573

Closed jansav closed 1 year ago

jansav commented 2 years ago

This issue is a way to track progress with elimination of global shared state in OpenLens.

Things to consider

Red flag trigger words

On encounter of any of these phrases in codebase, one is likely to be dealing with global shared state.

Singleton -base-class usages

Registries

Most of the registries can be replaced with reactive solutions relatively easily. Think if this is feasible at the same time.

Stores

Other stuff

Exporting already instantiated class

Global search with RegExp: export const .* = new

Other stuff

Nokel81 commented 2 years ago

Exporting already instantiated class

While I really want to do this part. I don't quite see how we can without a major version bump to the extension API.

jansav commented 2 years ago

Exporting already instantiated class

While I really want to do this part. I don't quite see how we can without a major version bump to the extension API.

Lets see. I think we have some ideas, but haven’t tested them about yet.

Iku-turso commented 2 years ago

Note: Added Red flag trigger words to description

Red flag trigger words

On encounter of any of these phrases in codebase, one is likely to be dealing with global shared state.

  • .createInstance() and .getInstance()
  • static
  • export anything-with-state
Iku-turso commented 2 years ago

Hear hear: elimination of shared global state is the current Team Technical Focus (TTF).

Nokel81 commented 2 years ago

Should the checkmarks really be checked for PRs that are closed and not merged?

Nokel81 commented 1 year ago

Closing as the bulk work is now done. Just need to remove as many uses of the legacyGlobal family of functions as possible now.

🎉