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

Change the way we distinguish client from server #239

Merged

Conversation

BohdanYavorskyi
Copy link
Contributor

@BohdanYavorskyi BohdanYavorskyi commented Dec 21, 2023

From @kkomelin :

Previous condition typeof process === 'undefined' that detected client stopped working when some frameworks started to misuse the process variable, so we need to find a better way to distinguish client from server.

Many libraries are using the typeof window !== 'undefined' condition to detect the client instead, and it's currently the best known way to do it, so let's switch to it.

Even though the change is more or less safe, we are planning to release a new major version to avoid breaking things.

@kkomelin
Copy link
Owner

Thank you @BohdanYavorskyi for your contribution.
It's an obvious change but still a bit risky, so I think we need to release it as a new major version. What do you think?

@BohdanYavorskyi
Copy link
Contributor Author

Thank you @BohdanYavorskyi for your contribution. It's an obvious change but still a bit risky, so I think we need to release it as a new major version. What do you think?

yeah, can be major one

@kkomelin kkomelin changed the title chore: update client side check to use window Change the isClientSide checking condition in order to use window Dec 23, 2023
@kkomelin kkomelin changed the title Change the isClientSide checking condition in order to use window Change a way we distinguish server from client Dec 23, 2023
@kkomelin kkomelin self-assigned this Dec 23, 2023
@kkomelin kkomelin added bug Something isn't working enhancement New feature or request labels Dec 23, 2023
@kkomelin kkomelin changed the title Change a way we distinguish server from client Change a way we distinguish client from server Dec 23, 2023
@kkomelin kkomelin merged commit e0ef976 into kkomelin:master Dec 23, 2023
2 checks passed
@kkomelin
Copy link
Owner

Thanks again @BohdanYavorskyi. I'm preparing for a new major release. However, I cannot guarantee that all people like it, and if I see a better solution, I can consider switching to it in the future. For now, we should be good.

@kkomelin kkomelin changed the title Change a way we distinguish client from server Change the way we distinguish client from server Dec 23, 2023
@kkomelin
Copy link
Owner

Please test and let me know if you notice any issues https://github.com/kkomelin/isomorphic-dompurify/releases/tag/v2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants