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

Unhandled Promise Rejection: TypeError: el is not an Object #298

Closed
SamusAranX opened this issue Nov 27, 2021 · 3 comments
Closed

Unhandled Promise Rejection: TypeError: el is not an Object #298

SamusAranX opened this issue Nov 27, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@SamusAranX
Copy link

I'm using Safari on macOS Monterey.

This is how I tried initializing the autocompletion thing:

var ac;
window.addEventListener("load", function () {
	let config = {
		selector: ".autocomplete",
		wrapper: true,
		data: {
			src: async (query) => {
				try {
					let source = await fetch(SUGGEST_ENDPOINT);
					return await source.json();
				} catch (error) {
					return error;
				}
			},
			keys: null
		},
		debounce: 300,
		placeHolder: "Search",
	};
	ac = new autoComplete({config});
}

Every time I reload the site, I get this error in the console:

[Error] Unhandled Promise Rejection: TypeError: el is not an Object. (evaluating 'key in el')
	create (autoComplete.js:182)
	(anonymous function) (autoComplete.js:557)
	Promise
	init (autoComplete.js:547)
	autoComplete (autoComplete.js:649)
	(anonymous function) (core.js:35)

What's happening here?

@SamusAranX SamusAranX added the bug Something isn't working label Nov 27, 2021
@folknor
Copy link

folknor commented Nov 27, 2021

Change

ac = new autoComplete({config});

to

ac = new autoComplete(config);

@SamusAranX
Copy link
Author

Well, that was easy. Please adjust the usage instructions here (https://tarekraafat.github.io/autoComplete.js/#/usage?id=_2-script) because they currently tell you to do what I did.

@clementmas
Copy link

I agree, the instructions new autoComplete({ config }) are misleading. I had the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants