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

Adapter.replace, one-to-one only #229

Merged
merged 8 commits into from
Dec 6, 2020
Merged

Adapter.replace, one-to-one only #229

merged 8 commits into from
Dec 6, 2020

Conversation

dhilt
Copy link
Owner

@dhilt dhilt commented Dec 1, 2020

For issue #171.

@dhilt dhilt force-pushed the issue-171-adapter-replace branch from b398f32 to 6dc1422 Compare December 1, 2020 14:58
@duxor
Copy link

duxor commented Dec 5, 2020

We definitely need this. Replacement with "remove + insert" has an issue if we work with elements in the viewport.

@dhilt
Copy link
Owner Author

dhilt commented Dec 5, 2020

@duxor Hi! At least 1-2 weeks are needed to complete the in-viewport many-to-many replacement feature. But one-to-one replacement is already done, and if you need it, I can release ngx-ui-scroll v1.11.0-rc

@duxor
Copy link

duxor commented Dec 5, 2020

Hi @dhilt
It should be great, please do it, thanks.

@dhilt dhilt merged commit 5c38ee4 into master Dec 6, 2020
@dhilt dhilt changed the title Adapter.replace Adapter.replace, one-to-one only Dec 6, 2020
@dhilt
Copy link
Owner Author

dhilt commented Dec 6, 2020

@duxor ngx-ui-scroll v1.11.0-rc is on npm, it has basic Adapter.replace implementation. The syntax as follows:

datasource.adapter.replace({
  predicate: ({ $index, data, element }) => $index === indexToReplace,
  items: [itemToReplace]
})

Note, predicate must return true no more than 1 time, items must contain only 1 item. Would be great to get any feedback on this!

@dhilt dhilt mentioned this pull request Dec 6, 2020
@duxor
Copy link

duxor commented Dec 6, 2020

@dhilt awesome! Works as expected, thanks.

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.

2 participants