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

[items] Check how to avoid filtered items to be initialized with all items #357

Open
thekangaroofactory opened this issue Oct 26, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request new feature Extra attention is needed

Comments

@thekangaroofactory
Copy link
Owner

From testing, it seems that filtered_items is initialized with all items before being filtered.
This makes plots be rendered twice upon startup. First with all data, then refreshed with filtered data.

Maybe date_slider get the whole range before the strategy (this-year) is applied.
That could be a setting to make sure initialization is done properly and avoid unnecessary updates.

@thekangaroofactory thekangaroofactory added the enhancement New feature or request label Oct 26, 2024
@thekangaroofactory thekangaroofactory self-assigned this Oct 26, 2024
thekangaroofactory added a commit that referenced this issue Oct 27, 2024
thekangaroofactory added a commit that referenced this issue Oct 27, 2024
@thekangaroofactory
Copy link
Owner Author

thekangaroofactory commented Oct 27, 2024

filtered_items reactive calls:

  1. at init: filter_date is NULL so it returns the items
  2. when filter_date is updated: it returns the filtered items

If the first call is removed (bindEvent with ignoreInit = TRUE), then filtered_items will be NULL at startup
But if the date slider is not used in the UI, it will always remain NULL

I didn't find any way to check that the date_slider will be in use (it's not initialized on first call, so the input does not exist)

This improvement requires to know if the user will implement the date slider in its UI.
Maybe the date slider could be an option in the admin console
Then we could skip first call with all items by returning NULL if the option is ON.

In the meantime, it's up to the user to set ignoreInit = TRUE when taking dependency on filtered_items
if the date slider is implemented.
For example, to not compute a plot on filtered_items until its updated.
Documentation is delivered here #364

maybe check for the id in the ui html ??

@thekangaroofactory thekangaroofactory added the new feature Extra attention is needed label Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new feature Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant