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

Rerun filters #102

Open
Steditor opened this issue Jan 22, 2021 · 1 comment
Open

Rerun filters #102

Steditor opened this issue Jan 22, 2021 · 1 comment

Comments

@Steditor
Copy link
Contributor

In my application, a field is only synchronized to some clients that are specified to be admins of the room. The filter works fine as long as no client changes its state.
When a client newly becomes admin, the filter is not reapplied, as the filtered field has no changes. Currently I apply a workaround (manually touching the field in the schema's $changes) to trigger a re-run of the filter.

This kind of defeats the purpose of having a declarative filter. A filter function that is re-run reactively as soon as a dependency changes would be awesome (kind of what UI frameworks like vue etc. do). However, this could potentially have a negative influence on the synchronization performance.

Is there a better way to force colyseus to send a client newly filtered data? If not, said workaround for could maybe be incorporated into the official documentation or even get a "cleaner" API.

@endel
Copy link
Member

endel commented Jan 22, 2021

Hey @Steditor,

Unfortunately, that is a limitation of the current filter implementation.

Currently I apply a workaround (manually touching the field in the schema's $changes) to trigger a re-run of the filter.

On the "agario-style" demo I've used the same workaround!

If not, said workaround for could maybe be incorporated into the official documentation or even get a "cleaner" API.
I agree with you that a cleaner API and having this limitation stated in the docs would be nice.

Thanks for reporting!

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

No branches or pull requests

2 participants