Skip to content

Fix import form errors #9498

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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

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