Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/javascript/oldjs/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ window.ImportSetup = {
window.addEventListener('message', function(event) {
var messageData = event.data.message;

if (messageData.level === 'error') {
if (messageData && messageData.level === 'error') {
Copy link
Member

Choose a reason for hiding this comment

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

Can we use the chaining operator?

Suggested change
if (messageData && messageData.level === 'error') {
if (messageData?.level === 'error') {

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure, its throwing these errors with it

Screenshot 2025-06-13 at 3 44 53 PM

Copy link
Member

@Fryguy Fryguy Jun 17, 2025

Choose a reason for hiding this comment

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

ugh why is Javascript so terrible - ok I guess back to the original code :(

https://stackoverflow.com/questions/59972341/how-to-make-webpack-accept-optional-chaining-without-babel

Looks like it's in webpack 5

Copy link
Contributor

Choose a reason for hiding this comment

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

I think a good solution is to upgrade webpack and babel packages. However, even with Webpack 4, we can enable optional chaining support by updating the Babel configuration to include the necessary transform plugin, as discussed here

showErrorMessage(messageData.message);
$('#git-url-import').prop('disabled', null);
} else if (event.data.git_branches || event.data.git_tags) {
Expand Down