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

AutocompletePicker: `useCache: false` still uses the cache #511

Closed
c-frater opened this Issue Oct 2, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@c-frater
Copy link
Contributor

c-frater commented Oct 2, 2018

Context

When setting up an autocomplete with an external matcher and useCache: false the picker still shows values that were removed from the results that it has retrieved from the cache for the '' search instead of getting values from the endpoint again

Expected Behavior

The autocomplete picker should always get results from the endpoint

Actual Behavior

The autocomplete picker retrieves results from the cache

Possible Fix

Passing the useCache option through to the AutocompleteFeed should resolve the problem

Workaround

Call AutocompletePicker.clearCache() method when removing items from the array in this case would resolve the issue

Steps to Reproduce

let itemsArr = [
  'a',
  'b',
  'c'
]

function items (term, callback) {
  callback(itemsArr.filter((item) => item.indexOf(term) > -1))
}

function removeItem() {
  itemsArr.pop()
}

const acp = hx.div()

new hx.AutocompletePicker(acp, items, {
  matchType: 'external',
  useCache: false
})

const removeBtn = hx.button().text('Remove Item')
  .on('click', removeItem)

hx.select('body').clear()
  .add(acp)
  .add(removeBtn)
  1. Open picker
  2. Click 'Remove Item' button
  3. Open picker again
  4. c is still shown in the list despite being removed from the array
  5. Confirm removal by searching for c

Your Environment

  • Hexagon Version: 1.10.0

c-frater added a commit that referenced this issue Nov 21, 2018

Merge pull request #517 from ocadotechnology/511_autocomplete-picker-…
…caching

#511 fix(autocomplete-picker): Pass the useCache option through

@c-frater c-frater closed this in 7b00147 Dec 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment