Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

add cacheSearchTerm option #251

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open

Conversation

crystalline
Copy link

Add cacheSearchTerm option (defaults to true, the same behavior as before) to mitigate #168

To fix the issue set cacheSearchTerm attribute of the ng2-completer to true.

Also add index.ts file, so ng2-completer could be installed from github like this: "yarn add yarn add https://github.com/oferh/ng2-completer

@oferh
Copy link
Owner

oferh commented Jun 13, 2017

thanks for the PR.

there is already an index.ts under src

@crystalline
Copy link
Author

Top-level index.ts is a copy of src one, with "src/" added to all import paths
Without this top-level index.ts it isn't possible to simply install the ng2-completer from the github via yarn or npm (it is possible if you edit your source to import from ng2-completer/src instead of ng2-completer).
If you don't like it you could remove it, but then I'd have to use my fork where there is ./index.ts .

@oferh
Copy link
Owner

oferh commented Jun 13, 2017

can you split it to 2 PR's?
I think that changing typings path in package.json should be the solution for the location of index.ts.

@crystalline
Copy link
Author

Ok, removed index.ts for now (but left that commit unchanged because I already depend on it in my project), will do something about index.ts or typings in the next PR

@oferh
Copy link
Owner

oferh commented Jun 13, 2017

can you change it so that CompleterData can pass a resetDataSource flag that will trigger the term reset?

@oferh oferh changed the title add cacheSearchTerm option and index.ts file for easy npm install fro… add cacheSearchTerm option Jun 24, 2017
bug: unnecessary search reload when cacheSearchTerm  is false when KEY_DOWN event occurs leads to incorrect behavior
@oferh oferh changed the base branch from master to dev July 8, 2017 06:03
@@ -83,7 +83,7 @@ export class CtrInput {
else if (event.keyCode === KEY_DW) {
event.preventDefault();

this.completer.search(this.searchStr);
if (!this.completer.opened) { this.completer.search(this.searchStr) }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what was the issue here?

@oferh
Copy link
Owner

oferh commented Jul 14, 2017

version 1.5.4 now includes dataSourceChange event in CompleterData when it is emitted CtrList will clear the cached term.

@marciomsm
Copy link

@oferh do you know when this PR will be merged? I am using cacheSearchTerm in my fork, but I am waiting to revert to your repository as a dependency in my project. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants