Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

(ngSubmit) and (submit) do not prevent default form submit causing a page reload #1891

Open
5 tasks done
insinfo opened this issue Apr 29, 2020 · 12 comments
Open
5 tasks done

Comments

@insinfo
Copy link

insinfo commented Apr 29, 2020

(ngSubmit) and (submit) do not prevent default form submit causing a page reload

  • Dart VM version: 2.7.1 (Thu Jan 23 13:02:26 2020 +0100) on "windows_x64"
  • AngularDart Version ^5.3.0
  • Whether you are using Windows, macOS, or Linux
  • Whether you are using Chrome 81.0.4044.122 64 bits
  • angular_components: ^0.13.0 angular_forms: ^2.1.2 angular_test: ^2.3.0 build_runner: ^1.6.0 build_web_compilers: ^2.3.0 build_test: ^0.10.8 pedantic: ^1.8.0 test: ^1.6.0

(ngSubmit) and (submit) do not prevent default form submit causing a page reload

and causing EXCEPTION TypeError on dart2js

webdev serve --hostname localhost --release

VM3327 main.dart.js:5232 EXCEPTION: TypeError: Instance of 'cp': type 'cp' is not a subtype of type 'minified:n'
STACKTRACE:
TypeError: Instance of 'cp': type 'cp' is not a subtype of type 'minified:n'
at Object.b (http://localhost:8080/main.dart.js:193:3)
at Object.m (http://localhost:8080/main.dart.js:545:48)
at eI.$0 (http://localhost:8080/main.dart.js:5788:34)
at hJ.$0 (http://localhost:8080/main.dart.js:5975:14)
at i9.k4 [as $1$4] (http://localhost:8080/main.dart.js:1066:9)
at b9.cr (http://localhost:8080/main.dart.js:5916:79)
at Object.eval (eval at lf (http://localhost:8080/main.dart.js:333:8), :3:43)
at j0.C (http://localhost:8080/main.dart.js:3472:79)
at j0.W (http://localhost:8080/main.dart.js:3440:10)
at eJ.$1 (http://localhost:8080/main.dart.js:5785:5)

$1 @ VM3327 main.dart.js:5232
$1 @ VM3327 main.dart.js:5984
k5 @ VM3327 main.dart.js:1078
ct @ VM3327 main.dart.js:5926
eval @ VM3359:3
a5 @ VM3327 main.dart.js:3479
aU @ VM3327 main.dart.js:3446
ai @ VM3327 main.dart.js:3356
bU @ VM3327 main.dart.js:3340
ai @ VM3327 main.dart.js:3093
k @ VM3327 main.dart.js:3059
eu @ VM3327 main.dart.js:5944
eval @ VM3351:3
a2 @ VM3327 main.dart.js:3464
W @ VM3327 main.dart.js:3442
$1 @ VM3327 main.dart.js:5785
oj @ VM3327 main.dart.js:266
(anonymous) @ VM3327 main.dart.js:274
Navigated to http://localhost:8080/?

project for reproducer bug
https://github.com/insinfo/angular_form_bug

It works:

Microsoft Edge 44.18362.449.0 Windows 10 64-bit;
Firefox 72.0.2 64-bit Windows 10 64-bit;
Firefox Developer 72.0b5 64-bit Windows 10 64-bit;
Internet Explorer 11.657.18362.0 Windows 10 64-bit
Safari 5.1.7 (7534.57.2) Windows 10 64-bit
Google Chrome iphone 6S ios 13.3.1
Google Chrome Linux Ubuntu 18
Google Chrome Android 9

Does not work:

New Microsoft Edge 81.0.416.64 Windows 10 64-bit
Google Chrome 81.0.4044.122 64-bit Windows 10 64-bit
Brave 1.7.98 Chromium: 81.0.4044.113 64-bit Windows 10 64-bit
Opera 68.0.3618.63 Windows 10 64-bit
Vivaldi 3.0.1874.33 64-bit Windows 10 64-bit
Firefox 75.0 64bits Linux Ubuntu 18

@thiagosantoscunha
Copy link

@insinfo I understand what you are going through ...

I made a comment ... it sucks to see a situation like this ... What ends up happening is having to make a patch, when in fact, the technology that helps me should do her simple job. Several government-level projects are breaking down, and they are going to break down even more.

dart-lang/sdk#41708 (comment)

@insinfo
Copy link
Author

insinfo commented Apr 29, 2020

in dart version: 2.8.0-dev.14.0 (Thu Mar 12 11:00:10 2020 +0100) on "windows_x64"
the problem persists, but with a slightly better error message

VM2420 main.dart.js:5430 EXCEPTION: TypeError: Instance of 'SubmitEvent': type 'minified:cg' is not a subtype of type 'minified:k'
STACKTRACE:
TypeError: Instance of 'SubmitEvent': type 'minified:cg' is not a subtype of type 'minified:k'
at Object.b (http://192.168.66.123:8080/main.dart.js:191:3)
at au.oi [as b] (http://192.168.66.123:8080/main.dart.js:658:9)
at hJ.$0 (http://192.168.66.123:8080/main.dart.js:5987:39)
at iV.$0 (http://192.168.66.123:8080/main.dart.js:6168:14)
at eS.ka [as $1$4] (http://192.168.66.123:8080/main.dart.js:1417:9)
at bE.cs (http://192.168.66.123:8080/main.dart.js:6113:20)
at Object.eval (eval at lo (http://192.168.66.123:8080/main.dart.js:331:8), :3:43)
at fh.F (http://192.168.66.123:8080/main.dart.js:3801:20)
at fh.Y (http://192.168.66.123:8080/main.dart.js:3769:10)
at hK.$1 (http://192.168.66.123:8080/main.dart.js:5984:5)

$1 @ VM2420 main.dart.js:5430
$1 @ VM2420 main.dart.js:6177
kb @ VM2420 main.dart.js:1429
cu @ VM2420 main.dart.js:6122
eval @ VM2454:3
a7 @ VM2420 main.dart.js:3808
aS @ VM2420 main.dart.js:3775
ak @ VM2420 main.dart.js:3684
bU @ VM2420 main.dart.js:3668
ak @ VM2420 main.dart.js:3421
l @ VM2420 main.dart.js:3387
ex @ VM2420 main.dart.js:6138
eval @ VM2446:3
a4 @ VM2420 main.dart.js:3793
Y @ VM2420 main.dart.js:3771
$1 @ VM2420 main.dart.js:5984
pf @ VM2420 main.dart.js:264
(anonymous) @ VM2420 main.dart.js:272
Navigated to http://192.168.66.123:8080/?

in dart version: 2.9.0-4.0.dev (dev) (Tue Apr 28 09:41:22 2020 +0200) on "windows_x64"
the problem does not occur

@insinfo
Copy link
Author

insinfo commented Apr 29, 2020

at angular 6.0.0-alpha+1 with dart 2.7.2 the same problem occurs

EXCEPTION: TypeError: Instance of 'cv': type 'cv' is not a subtype of type 'minified:n'
STACKTRACE:
TypeError: Instance of 'cv': type 'cv' is not a subtype of type 'minified:n'
at Object.b (http://192.168.66.123:8080/main.dart.js:193:3)
at Object.m (http://192.168.66.123:8080/main.dart.js:545:48)
at i1.$0 (http://192.168.66.123:8080/main.dart.js:6021:34)
at hJ.$0 (http://192.168.66.123:8080/main.dart.js:6164:14)
at ic.k9 [as $1$4] (http://192.168.66.123:8080/main.dart.js:1066:9)
at bc.cB (http://192.168.66.123:8080/main.dart.js:6105:79)
at Object.eval (eval at lm (http://192.168.66.123:8080/main.dart.js:333:8), :3:43)
at j3.C (http://192.168.66.123:8080/main.dart.js:3483:79)
at j3.Y (http://192.168.66.123:8080/main.dart.js:3451:10)
at i2.$1 (http://192.168.66.123:8080/main.dart.js:6018:5)

$1 @ VM3938 main.dart.js:5251
$1 @ VM3938 main.dart.js:6173
ka @ VM3938 main.dart.js:1078
cD @ VM3938 main.dart.js:6115
eval @ VM3972:3
a7 @ VM3938 main.dart.js:3490
aY @ VM3938 main.dart.js:3457
ak @ VM3938 main.dart.js:3367
c8 @ VM3938 main.dart.js:3351
ak @ VM3938 main.dart.js:3104
k @ VM3938 main.dart.js:3070
eI @ VM3938 main.dart.js:6133
eval @ VM3964:3
a5 @ VM3938 main.dart.js:3475
Y @ VM3938 main.dart.js:3453
$1 @ VM3938 main.dart.js:6018
ov @ VM3938 main.dart.js:266
(anonymous) @ VM3938 main.dart.js:274
Navigated to http://192.168.66.123:8080/?

@insinfo
Copy link
Author

insinfo commented Apr 29, 2020

if parameter - -O4 is passed with a custom builder file the problem does not occur

build.yaml

targets:
  $default:
    builders:
      build_web_compilers|entrypoint:
        generate_for:
        - web/**.dart
        options:
          dart2js_args:
            #- --no-minify
            -  -O4
            -  --minify

@insinfo
Copy link
Author

insinfo commented Apr 29, 2020

with --no-minify

VM5189 main.dart.js:11057 EXCEPTION: TypeError: Instance of 'UnknownJavaScriptObject': type 'UnknownJavaScriptObject' is not a subtype of type 'Event'
STACKTRACE:
TypeError: Instance of 'UnknownJavaScriptObject': type 'UnknownJavaScriptObject' is not a subtype of type 'Event'
at Object.wrapException (http://192.168.66.123:8080/main.dart.js:518:17)
at Object.assertSubtypeOfRuntimeType (http://192.168.66.123:8080/main.dart.js:1388:17)
at RenderView_eventHandler1__closure.call$0 (http://192.168.66.123:8080/main.dart.js:12511:36)
at NgZone__run_closure.call$0 (http://192.168.66.123:8080/main.dart.js:12761:26)
at StaticClosure._rootRun [as call$1$4] (http://192.168.66.123:8080/main.dart.js:2536:16)
at NgZone._run$1$4 (http://192.168.66.123:8080/main.dart.js:12656:158)
at Object.eval (eval at Closure_forwardCallTo (http://192.168.66.123:8080/main.dart.js:873:14), :3:47)
at _CustomZone.run$1$1 (http://192.168.66.123:8080/main.dart.js:7369:158)
at _CustomZone.runGuarded$1 (http://192.168.66.123:8080/main.dart.js:7303:14)

@ganigeorgiev
Copy link

ganigeorgiev commented Apr 30, 2020

@insinfo, @thiagosantoscunha it is the same as #1889. Either update to the latest dart 2.8-dev version, or just add the following snippet to alias the SubmitEvent - dart-lang/sdk#40901 (comment).

@insinfo
Copy link
Author

insinfo commented Apr 30, 2020

@ganigeorgiev
What version of dart 2.8? Because with dart version: 2.8.0-dev.14.0 the problem persists

@ganigeorgiev
Copy link

@insinfo Dart 2.8.0-dev.20.7 (changes)

@insinfo
Copy link
Author

insinfo commented Apr 30, 2020

@ganigeorgiev
Is this version available in chocolatey and apt package managers?

@ganigeorgiev
Copy link

ganigeorgiev commented Apr 30, 2020

@sigmundch
Copy link

@athomas - are the latest dev releases available on chocolatey?

@athomas
Copy link

athomas commented Apr 30, 2020

Re: availability of the releases:

So these releases have the fix (on beta it's a cherrypick with a different hash), and the upcoming 2.8.1 stable will also have it:

$ git tag --contains 43ceccabb21ce683a6da64570ed9ab48ca188a1a
2.8.0-20.11.beta
2.8.0-dev.20.7
$ git tag --contains 5ed1850933651b13cb52fc9319c2cbc599fc97d6
2.9.0-1.0.dev
2.9.0-2.0.dev
2.9.0-3.0.dev
2.9.0-4.0.dev
2.9.0-5.0.dev

The easiest is probably to use the latest 2.9 dev release (those are published everywhere as usual). An alternative is to use the 2.8.0-20.11.beta which should also be published everywhere but because it's not the latest unstable release, is sorted weirdly by tooling because the version scheme changed and a beta release you'll have to install specially, see: https://github.com/dart-lang/sdk/wiki/Installing-beta-and-dev-releases-with-brew,-choco,-and-apt-get#installing-and-upgrading-on-windows-with-chocolatey.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants