metafizzy / metafizzy/infinite-scroll

Plugin instance is ignoring new path function set with InfiniteScroll.prototype.option method

Open
#936 5 comments 0 reactions 0 assignees View on GitHub
How do I?
Dominant language
HTML
Stars
7.5k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

What it says in the description. My case is a form where a user can enter a search term for an api request. Every new form submission I need to reset path option to generate proper URL with query param.

Made a simple live example where after infScroll.option({path() {}}) the instance is still using the path function that it was initialized with. Here's a [link to CodePen](https://codepen.io/goit-academy/pen/JjRwXgV).

PS: Under the hood option method is using Object.assign and it actually works fine with other options, but for some reason ignores new path function.

PSS: Perhaps I'm supposed to destroy and reinitialize a new instance on every form submission?

Contributor guide

Open the contributing guide

Research direction

Start with the linked CodePen reproduction and verify that calling InfiniteScroll.prototype.option with a new path function does not change the URL generation behavior. Trace the option update and path resolution flow in the repository, then add or update a regression test showing that a newly supplied path function is used after each form submission.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.