-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
TypeError: Cannot read property 'then' of undefined #1532
Comments
Can you make a repro please? |
I'm trying but no success until now. Perhaps it's some plugin. Edit: export function mapSequence ( array, fn ) {
const results = [];
let promise = Promise.resolve();
function next ( member, i ) {
return fn( member ).then( value => results[i] = value );
}
for ( let i = 0; i < array.length; i += 1 ) {
promise = promise.then( () => next( array[i], i ) );
}
return promise.then( () => results );
} Specifically:
|
@Rich-Harris actually the problem (my guess) is when you have multiple configs. |
use Promise.resolve in mapSequence, to ensure each item is thenable
Thank you — this is fixed in 0.47.5 |
i Have also same problem.. please help me out import React, { useState, useEffect } from 'react' import ProductDataSource from './Constant/ProductDataSource' import '../BuisnessPost/style.scss' // import Modal from 'src/components/Cell'17 const BuisnessPost = () => { const handleClose = () => setShow(false) // delete handle // data from firebase // message popups // const ProductDataSource = [ // <ImageIcon style={{ width: '100px' }} src={Images.AVATAR} /> // // // <ImageIcon style={{ width: '100px' }} src={Images.AVATAR} /> // // // ), // Product: 'cam', // Price: ' $100 ', // Description: ' Camera for photography ', // status: 'Active', // created: '12 june 2021', // }, // ] return (
) |
Having the same issue, happens with Promise in Input:rollup v2.58.1 rollup.config.jsimport json from '@rollup/plugin-json';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import nodePolyfills from 'rollup-plugin-polyfill-node';
export default {
input: 'src/src_mapInit.js',
context: 'window',
output: {
file: 'build/mapInit.js',
format: 'iife',
},
plugins: [json(),resolve(),nodePolyfills(),
commonjs()]
}; src/src_mapInit.jsimport { Map, Polyline, GeoJSON, TileLayer, Canvas } from 'Leaflet';
import {MapSettings, LayerSettings} from "./classes/Settings.js";
window.onload = function (){
mapInit();
}
function mapInit() {
//...bunch of leaflet stuff that works
var loadJson = new Promise((resolve, reject) => {
var request = new XMLHttpRequest();
request.open('GET', "./geojson/map_template.json");
request.setRequestHeader('Content-Type', 'application/json');
request.responseType = 'json';
request.onload = function() {
if (request.status === 200) {
resolve(request.response);
} else {
reject(Error('Json didn\'t load successfully; error code:' + request.statusText));
}
}
request.onerror = function() {
reject(Error('There was a network error.'));
};
request.send();
});
loadJson.then((map_template) => {
GeoJSON(map_template).addTo(map);
});
} html:
error
stack trace:
mapInit.js:261 (+- line or two)// @class Class
// @aka L.Class
// @section
// @uninheritable
// Thanks to John Resig and Dean Edwards for inspiration!
function Class() {}
Class.extend = function (props) {
// @function extend(props: Object): Function
// [Extends the current class](#class-inheritance) given the properties to be included.
// Returns a Javascript function that is a class constructor (to be called with `new`).
var NewClass = function () {
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// call the constructor
if (this.initialize) { // this.initialize is asking undefined this - why? <----- ERROR IN QQ
this.initialize.apply(this, arguments);
}
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// call all constructor hooks
this.callInitHooks();
};
var parentProto = NewClass.__super__ = this.prototype;
var proto = create$2(parentProto);
proto.constructor = NewClass;
NewClass.prototype = proto;
// inherit parent's statics
for (var i in this) {
if (Object.prototype.hasOwnProperty.call(this, i) && i !== 'prototype' && i !== '__super__') {
NewClass[i] = this[i];
}
}
// mix static properties into the class
if (props.statics) {
extend(NewClass, props.statics);
delete props.statics;
}
// mix includes into the prototype
if (props.includes) {
checkDeprecatedMixinEvents(props.includes);
extend.apply(null, [proto].concat(props.includes));
delete props.includes;
}
// merge options
if (proto.options) {
props.options = extend(create$2(proto.options), props.options);
}
// mix given properties into the prototype
extend(proto, props);
proto._initHooks = [];
// add method for calling all hooks
proto.callInitHooks = function () {
if (this._initHooksCalled) { return; }
if (parentProto.callInitHooks) {
parentProto.callInitHooks.call(this);
}
this._initHooksCalled = true;
for (var i = 0, len = proto._initHooks.length; i < len; i++) {
proto._initHooks[i].call(this);
}
};
return NewClass;
}; |
Rollup:
0.46.1
This happens with
watch
option at the first modification.The text was updated successfully, but these errors were encountered: