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

RequestMemory: Add refresh method #106

Closed
wants to merge 1 commit into from
Closed

RequestMemory: Add refresh method #106

wants to merge 1 commit into from

Conversation

kfranqueiro
Copy link
Contributor

This adds a refresh method which will instruct the store to
reload its data from either the existing server endpoint, or a new
endpoint passed to the method.

Inspired by http:https://stackoverflow.com/a/28756348/237950 because people shouldn't need to be that intimately familiar with Cache to do this.

Includes tests, doc update, and some improved comments.

(Note: the diff here might make it look like this strips a newline-at-EOF... actually, there were two trailing newlines, and it strips one of them.)

This adds a refresh method which will instruct the store to
reload its data from either the existing server endpoint, or a new
endpoint passed to the method.

Includes tests, doc update, and some improved comments.
@kfranqueiro
Copy link
Contributor Author

The person who asked the original question on SO pointed out that calling invalidate does not actually flush the cache store - i.e., any items from the old data that are not also present in the new data will still persist.

For the typical case where the cache store is Memory, we could call setData([]), but IINM it's technically possible to pass in your own cacheStore which could be something else, so I'm not sure that's a safe assumption.

I guess we could seriously iterate through the items and call remove as well, but that seems pretty onerous. Thoughts?

@RoyTinker
Copy link

I'm struggling with this issue now. I want to reload a dgrid with different URL parameters when a user selects a different option in a drop-down menu.

That scenario is really easy in ExtJS:

store.setBaseParam('someParameter', someValue);
store.reload();

@Newan
Copy link

Newan commented May 7, 2015

works for me

Update Patch is very useful

@kfranqueiro
Copy link
Contributor Author

@TimTheTinker FYI, regarding the SingleQuery mixin in the tutorial, we had identified a bug a few months ago in that mixin which IIRC would cause behavior like what you describe. The code in the tutorial has been updated to include a renderArray method: http:https://dgrid.io/tutorials/0.4/single_query/.

I'm surprised that the same thing happens in OnDemandGrid though, as I thought I had been testing with that. I'll have to re-test when we have an opportunity to consider this in a future version of dstore.

Copy link

@dylans dylans left a comment

Choose a reason for hiding this comment

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

Looks fine (needs a quick rebase).

@dylans dylans added this to the 1.2 milestone May 24, 2017
@msssk
Copy link
Contributor

msssk commented Jan 9, 2020

Changes merged in #230

@msssk msssk closed this Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants