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

fix: getContextPath did not work correctly when called in a browser #3814

Merged

Conversation

DaveAtKeelvar
Copy link
Contributor

What change does this PR introduce?

The function getContextPath does not work correctly when called from inside a web browser. process.env is only available when the function is called within node.js. When called inside a web browser, we need to instead use window._env_ to get access to the different context path variables.

Why was this change needed?

To support custom context paths for Novu web

Other information (Screenshots)

@DaveAtKeelvar
Copy link
Contributor Author

Feel free to tidy up the TypeScript code, I haven't really used TypeScript before, and I'm sure it could be neater.

@vfxGer
Copy link
Contributor

vfxGer commented Jul 18, 2023

Good catch

Comment on lines 11 to 14
// Determine if we are running in the browser or in node.js. If we are
// running in node.js, we will have access to the process.env object,
// otherwise we will have access to the window._env_ object to get the
// environment variables.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like there is some eslint error here, i believe you would need to convert this to a multiline comment /**

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I updated the code.

@DaveAtKeelvar
Copy link
Contributor Author

@scopsy Is there any hope in moving this forward?

@scopsy
Copy link
Contributor

scopsy commented Aug 2, 2023

@DaveAtKeelvar yes! Sorry about that, everytime I approve the test runs and then while waiting forget to come backto it to merge. Added an alarm reminder 😅

@scopsy scopsy merged commit 822114d into novuhq:next Aug 3, 2023
28 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants