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

Updating a stream element without inserting #2690

Closed
SteffenDE opened this issue Jun 13, 2023 · 4 comments · May be fixed by #3573
Closed

Updating a stream element without inserting #2690

SteffenDE opened this issue Jun 13, 2023 · 4 comments · May be fixed by #3573

Comments

@SteffenDE
Copy link
Collaborator

SteffenDE commented Jun 13, 2023

This is more of a feature request / discussion. Assume that you are rendering an infinitely scrollable table and are listening to changes using PubSub. When a PubSub message arrives, you want to update the element in the DOM, but only if is is actually currently rendered. If the element is not in the DOM, you do not want to insert it.

This can currently be achieved in some cases, e.g. when using pagination and there is a fixed page size. Then we can use at: -1, limit: rows_per_page which wants to append at the end, but limits the items to the number of items on the page. But even in this simple case this will fail if there is a page that is not already full. It also does not work in the example when using an infinite scrolled page that limits the maximum number of elements to, e.g., 3x the page size to have some buffer. On initial render, we render N items (limit is 3*N), therefore a stream_insert with limit 3*N would still append the element.

So I'd like to propose a function stream_update(stream, element) that can be used to update an element of a stream, if it is currently in the DOM that does not insert non-existing elements. What do you think?

@josevalim
Copy link
Member

Hi @SteffenDE, we are mostly focused on improving the current streams for now as we head towards v1.0. We can discuss new features in the future, but not our focus at the moment. :)

@SteffenDE
Copy link
Collaborator Author

Hmm okay, I see. Do you think it might make sense to leave the issue open to keep track of this feature then?

Other question would be: would you mind a PR that implements a functionality like this, or do you think that this does not fit into the current plan for streams in general?

@josevalim
Copy link
Member

Our focus is on solving the bug reports and merging the bug fixes today. It is unlikely we will prioritize new features until v1.0 is out.

@josevalim
Copy link
Member

Btw, I am just trying to be upfront about expectations. :) I don't want you to work on a PR or promote discussions that won't receive attention any time soon.

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 a pull request may close this issue.

2 participants