epam / ketcher

Web-based molecule sketcher
https://lifescience.opensource.epam.com/ketcher/demo.html
Apache License 2.0
470 stars 164 forks source link

Support for SSR #4981

Closed AlekseiKhariukov closed 2 months ago

AlekseiKhariukov commented 3 months ago

Background It is impossible to use ketcher in SSR applications because of errors. The reason is that ketcher uses browser APIs, such a "window" object, which are not supported on server side.

Solution Create example of SSR application which uses ketcher (similar what we have in /example folder). Wrap all usages of unsupported APIs into conditions to exclude it from execution on server side. Probably better option is to wrap the initialisation code to have this check in one place only.

Additional context It was found that Raphaeljs library(used for render in molecules mode) uses window object.

AlexeyGirin commented 2 months ago

No test cases needed for that issue

AlexeyGirin commented 1 month ago

Verified verbally.