diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 00000000..2a4766d3 --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,33 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages + +name: Node.js Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm ci + - run: npm test + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/README.md b/README.md index 4131748e..0f62dbde 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ export default function SimpleMap(){ ### My map doesn't appear! -- Make sure the container element has width and height. The map will try to fill the parent container, but if the container has no size, the map will collapse to 0 width / height. This is not a requirement for google-map-react, [its a requirement for google-maps in general](https://developers.google.com/maps/documentation/javascript/tutorial). +- Make sure the container element has width and height. The map will try to fill the parent container, but if the container has no size, the map will collapse to 0 width / height. This is not a requirement for google-map-react, [it's a requirement for google-maps in general](https://developers.google.com/maps/documentation/javascript/tutorial). ## Installation diff --git a/package.json b/package.json index 70cf63ea..e13031f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "google-map-react", - "version": "2.2.3", + "version": "2.2.5", "description": "Isomorphic component that allows rendering react components on a google map", "author": "istarkov https://github.com/istarkov", "license": "MIT", diff --git a/src/google_map.js b/src/google_map.js index c47613ed..c4f365a7 100644 --- a/src/google_map.js +++ b/src/google_map.js @@ -1,7 +1,7 @@ /* eslint-disable import/no-extraneous-dependencies, react/forbid-prop-types, no-console, no-undef */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import ReactDOM from 'react-dom'; +import ReactDOM, { flushSync } from 'react-dom'; // helpers import GoogleMapMap from './google_map_map'; @@ -703,7 +703,9 @@ class GoogleMap extends Component { this_._onChildMouseMove(); if (this_.markersDispatcher_) { - this_.markersDispatcher_.emit('kON_CHANGE'); + flushSync(() => { + this_.markersDispatcher_.emit('kON_CHANGE'); + }) if (this_.fireMouseEventOnIdle_) { this_.markersDispatcher_.emit('kON_MOUSE_POSITION_CHANGE'); } diff --git a/src/google_map_markers.js b/src/google_map_markers.js index e2fbb666..b6727026 100644 --- a/src/google_map_markers.js +++ b/src/google_map_markers.js @@ -93,7 +93,7 @@ export default class GoogleMapMarkers extends Component { this.props.dispatcher.removeListener('kON_CLICK', this._onChildClick); this.props.dispatcher.removeListener('kON_MDOWN', this._onChildMouseDown); - this.dimensionsCache_ = null; + this.dimensionsCache_ = {}; } _getState = () => ({