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

[google_maps_flutter_web] Snippet stopped working in infoWindow #67854

Closed
Sammius opened this issue Oct 11, 2020 · 17 comments · Fixed by flutter/plugins#3156 or flutter/plugins#3163
Closed
Assignees
Labels
c: regression It was better in the past than it is now found in release: 1.22 Found to occur in 1.22 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: maps Google Maps plugin P1 High-priority issues at the top of the work list package flutter/packages repository. See also p: labels. platform-web Web applications specifically

Comments

@Sammius
Copy link

Sammius commented Oct 11, 2020

A couple of days ago, everything was fine. Now the title works, but the snippet doesn't.
Does not give errors.

Screenshot 2020-10-11 at 10 24 59

Minimal code sample:

pubspec.yaml:

  google_maps_flutter: ^1.0.2
  google_maps_flutter_web: ^0.1.0+3

main.dart:

import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

void main() async {
  runApp(App());
}

class App extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: AppCore(),
    );
  }
}

class AppCore extends StatefulWidget {
  @override
  _AppCoreState createState() => _AppCoreState();
}
class _AppCoreState extends State<AppCore> {
  
  @override
  Widget build(BuildContext context) {
    return GoogleMap(
      initialCameraPosition: const CameraPosition(target: LatLng(0, 10), zoom: 4),
      markers: [
        Marker(
          markerId: MarkerId('markerId'),
          position: LatLng(0, 10),
          infoWindow: InfoWindow(
            title:'title',
            snippet: 'snippet', // <--- here
          )
        )
      ].toSet(),
    );
  }
}
% flutter doctor -v
[✓] Flutter (Channel master, 1.23.0-8.0.pre.284, on Mac OS X 10.15.7 19H2 x86_64, locale en-CY)
    • Flutter version 1.23.0-8.0.pre.284 at /Users/Sammius/Flutter/flutter
    • Framework revision eefcff900c (10 hours ago), 2020-10-10 23:42:02 +0200
    • Engine revision 11d756a62e
    • Dart version 2.11.0 (build 2.11.0-207.0.dev)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/Sammius/android
    • Platform android-29, build-tools 28.0.3
    • ANDROID_HOME = /Users/Sammius/android
    • ANDROID_SDK_ROOT = /Users/Sammius/android
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0.1, Build version 12A7300
    • CocoaPods version 1.10.0.rc.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] IntelliJ IDEA Community Edition (version 2019.2.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 39.0.5
    • Dart plugin version 192.7402

[✓] VS Code (version 1.50.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.15.0

[✓] Connected device (3 available)
    • iPhone 11 Pro (mobile) • 932ADBE8-AFEE-49F6-BED9-109EC9869A1B • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
    • Web Server (web)       • web-server                           • web-javascript • Flutter Tools
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 85.0.4183.121

! Doctor found issues in 1 category.
@TahaTesser
Copy link
Member

TahaTesser commented Oct 12, 2020

Hi @Sammius
Did you experience this issue after upgrading packages? Can you please provide working package versions that didn't have this issue as you mention?

I tried downgrading to the last version but the issue still exist on the web

  google_maps_flutter: ^1.0.1
  google_maps_flutter_web: ^0.1.0+2

@TahaTesser TahaTesser added in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels Oct 12, 2020
@Sammius
Copy link
Author

Sammius commented Oct 12, 2020

Hi @TahaTesser!

A week ago, everything worked on these versions, possibly due to an update of the engine or internal packages.

google_maps_flutter: ^1.0.2
google_maps_flutter_web: ^0.1.0+3

Unfortunately, I haven't switched to the web version for a while, but I have regularly updated Flutter, so I can't say for sure when the snippet stopped working.

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Oct 12, 2020
@TahaTesser
Copy link
Member

  google_maps_flutter: ^1.0.2
  google_maps_flutter_web: ^0.1.0+3
Web Mobile
image Screenshot_1602576976
complete code sample
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

void main() async {
  runApp(App());
}

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: AppCore(),
    );
  }
}

class AppCore extends StatefulWidget {
  @override
  _AppCoreState createState() => _AppCoreState();
}

class _AppCoreState extends State<AppCore> {
  @override
  Widget build(BuildContext context) {
    return GoogleMap(
      initialCameraPosition:
          const CameraPosition(target: LatLng(0, 10), zoom: 4),
      markers: [
        Marker(
            markerId: MarkerId('markerId'),
            position: LatLng(0, 10),
            infoWindow: InfoWindow(
              title: 'title',
              snippet: 'snippet', // <--- here
            ))
      ].toSet(),
    );
  }
}
flutter doctor -v
[✓] Flutter (Channel beta, 1.22.1, on Microsoft Windows [Version 10.0.19041.508], locale en-US)
    • Flutter version 1.22.1 at C:\Code\flutter_beta
    • Framework revision f30b7f4db9 (5 days ago), 2020-10-08 10:06:30 -0700
    • Engine revision 75bef9f6c8
    • Dart version 2.10.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at C:\Code\sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = C:\Code\sdk
    • Java binary at: C:\Code\android-studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[!] Android Studio
    • Android Studio at C:\Code\android-studio\
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • android-studio-dir = C:\Code\android-studio\
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[✓] VS Code (version 1.50.0)
    • VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.15.0

[✓] Connected device (3 available)
    • Android SDK built for x86 64 (mobile) • emulator-5554 • android-x64    • Android 9 (API 28) (emulator)
    • Web Server (web)                      • web-server    • web-javascript • Flutter Tools
    • Chrome (web)                          • chrome        • web-javascript • Google Chrome 86.0.4240.75

! Doctor found issues in 1 category.

@TahaTesser TahaTesser added found in release: 1.22 Found to occur in 1.22 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: first party p: maps Google Maps plugin platform-web Web applications specifically c: regression It was better in the past than it is now and removed in triage Presently being triaged by the triage team labels Oct 13, 2020
@Sammius
Copy link
Author

Sammius commented Oct 13, 2020

/cc @ditman

Dear David, could you please help with this problem?

Probably this problem appeared after the update sanitize_html 1.4.0. Since before the snippet fell off altogether, I received the following error:

        Marker(
          markerId: MarkerId('markerId'),
          position: LatLng(0, 10),
          infoWindow: InfoWindow( snippet: ''
            + ('<h3>Title</h3>')
            + ('<div>text text text</div>')
            + ('<br/><a href="https://www.google.com">Go to Google >>></a>'),  // <--- here
          )
        )
TypeError: this.addLinkRel is not a function
    at sane_html_validator.SaneHtmlValidator.new.[_sanitize] (http://localhost:51371/packages/sanitize_html/src/sane_html_validator.dart.lib.js:100:41)
    at sane_html_validator.SaneHtmlValidator.new.[_sanitize] (http://localhost:51371/packages/sanitize_html/src/sane_html_validator.dart.lib.js:109:26)
    at sane_html_validator.SaneHtmlValidator.new.sanitize (http://localhost:51371/packages/sanitize_html/src/sane_html_validator.dart.lib.js:70:22)
    at Object.sanitizeHtml (http://localhost:51371/packages/sanitize_html/sanitize_html.dart.lib.js:13:148)
    at Object._infoWindowOptionsFromMarker (http://localhost:51371/packages/google_maps_flutter_web/src/types.dart.lib.js:1532:195)
    at google_maps_flutter_web.MarkersController.new.[_addMarker] (http://localhost:51371/packages/google_maps_flutter_web/src/types.dart.lib.js:1237:55)
    at _HashSet.new.forEach (http://localhost:51371/dart_sdk.js:38342:11)
    at google_maps_flutter_web.MarkersController.new.addMarkers (http://localhost:51371/packages/google_maps_flutter_web/src/types.dart.lib.js:1230:39)
    at google_maps_flutter_web.GoogleMapController.new.updateMarkers (http://localhost:51371/packages/google_maps_flutter_web/src/types.dart.lib.js:618:30)
    at google_maps_flutter_web.GoogleMapsPlugin.new.updateMarkers (http://localhost:51371/packages/google_maps_flutter_web/src/types.dart.lib.js:253:27)
    at updateMarkers.next (<anonymous>)
    at runBody (http://localhost:51371/dart_sdk.js:37699:34)
    at Object._async [as async] (http://localhost:51371/dart_sdk.js:37730:7)
    at google_maps_flutter_web.GoogleMapsPlugin.new.updateMarkers (http://localhost:51371/packages/google_maps_flutter_web/src/types.dart.lib.js:252:20)
    at google_maps_flutter.GoogleMapController.__.[_updateMarkers] (http://localhost:51371/packages/google_maps_flutter/google_maps_flutter.dart.lib.js:180:61)
    at google_maps_flutter._GoogleMapState.new._updateMarkers$ (http://localhost:51371/packages/google_maps_flutter/google_maps_flutter.dart.lib.js:652:35)
    at _updateMarkers$.next (<anonymous>)
    at http://localhost:51371/dart_sdk.js:37679:33
    at _RootZone.runUnary (http://localhost:51371/dart_sdk.js:37533:58)
    at _FutureListener.thenAwait.handleValue (http://localhost:51371/dart_sdk.js:32507:29)
    at handleValueCallback (http://localhost:51371/dart_sdk.js:33054:49)
    at Function._propagateToListeners (http://localhost:51371/dart_sdk.js:33092:17)
    at async._AsyncCallbackEntry.new.callback (http://localhost:51371/dart_sdk.js:32818:27)
    at Object._microtaskLoop (http://localhost:51371/dart_sdk.js:37794:13)
    at _startMicrotaskLoop (http://localhost:51371/dart_sdk.js:37800:13)
    at http://localhost:51371/dart_sdk.js:33309:9

When I removed the href from <a> the error went away.

@ditman
Copy link
Member

ditman commented Oct 13, 2020

Have you tried adding rel="nofollow" to your link? It seems it's attempting to do something like that (reading the changelog for 1.4.0, it might be a bug with that package)

Thanks for reporting!

@ditman
Copy link
Member

ditman commented Oct 13, 2020

Ah, we need to add a new function to our call, it seems: https://github.com/google/dart-neats/pull/70/files

@ditman ditman added the P1 High-priority issues at the top of the work list label Oct 13, 2020
@ditman ditman self-assigned this Oct 13, 2020
@ditman ditman added this to the 1.24 - October 2020 milestone Oct 13, 2020
@ditman
Copy link
Member

ditman commented Oct 14, 2020

I've sent a PR to sanitize_html, I'll try to release a quick hotfix for this ASAP.

@ditman
Copy link
Member

ditman commented Oct 15, 2020

@Sammius sanitize_html 1.4.1 has a fix for the issue, you should be able to update your packages (maybe you need to delete your pubspec.lock so you get the latest sanitize_html).

(The PR above is still valid, I bumped the minimum version of sanitize_html to the good one, and added a new test to the package.)

@Sammius
Copy link
Author

Sammius commented Oct 15, 2020

@ditman is super! My Web is now working as expected.
Great thanks!!!

It's just not clear why the snippet is not displayed in a simple example?

@ditman
Copy link
Member

ditman commented Oct 15, 2020

I've just published the fixed version of google_maps_flutter_web.

@Sammius, snippets are still not showing for you?

@ditman
Copy link
Member

ditman commented Oct 15, 2020

Ah, what you mention looks like a different bug, related to #65152!

@Sammius
Copy link
Author

Sammius commented Oct 15, 2020

I've just published the fixed version of google_maps_flutter_web.

@Sammius, snippets are still not showing for you?

@ditman In the minimal example, the snippet does not work yet

@Sammius
Copy link
Author

Sammius commented Oct 15, 2020

Ah, what you mention looks like a different bug, related to #65152!

My humble experience does not allow me to judge this, but I hope that this problem can also be solved quickly :)

@ditman
Copy link
Member

ditman commented Oct 16, 2020

I hope that this problem can also be solved quickly :)

Yes, this one is 100% my fault :)

@ditman ditman reopened this Oct 16, 2020
@ditman
Copy link
Member

ditman commented Oct 16, 2020

(Reopening to address the initial load of InfoWindows)

ditman added a commit to flutter/plugins that referenced this issue Oct 22, 2020
* Update package:google_maps to ^3.4.5.
* Fix GoogleMapController.getLatLng(): flutter/flutter#67606
* Make InfoWindow contents clickable so onTap works as advertised: flutter/flutter#67289
* Fix InfoWindow snippets when converting initial markers: flutter/flutter#67854
@ditman
Copy link
Member

ditman commented Oct 22, 2020

The fix for the initialization issue of the simple example is published as google_maps_flutter_web: ^0.1.0+5

FlutterSu pushed a commit to FlutterSu/flutter-plugins that referenced this issue Nov 20, 2020
* Update package:google_maps to ^3.4.5.
* Fix GoogleMapController.getLatLng(): flutter/flutter#67606
* Make InfoWindow contents clickable so onTap works as advertised: flutter/flutter#67289
* Fix InfoWindow snippets when converting initial markers: flutter/flutter#67854
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2021
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: regression It was better in the past than it is now found in release: 1.22 Found to occur in 1.22 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: maps Google Maps plugin P1 High-priority issues at the top of the work list package flutter/packages repository. See also p: labels. platform-web Web applications specifically
Projects
None yet
3 participants