Open schloerke opened 1 year ago
Ok. So {sortable}
needs to not set the id values directly. Ex:
When these values are set, they are unaware of the NS
that is being used within a module.
Reasoning:
update_bucket_list()
calls session$sendInputMessage(id, msg)
. Linkid
. Link"bucket_lists-bucket-list-bucket_list_group"
. ({namespace}-{sortableprefix}-{cssid}
).I'm too far removed from the code to remember why I used css_id
and regular input_id`. Seems odd to me. 😞
If the css_id
were to be altered by adding a suffix (rather than a prefix), it could be used within modules if exposed in the function api. But this seems like a bandaid on top of a bandaid. This change would most likely be a breaking change for some users.
Originally posted by @schloerke in https://github.com/rstudio/sortable/issues/95#issuecomment-1574265598
I had proposed another solution but it does not fully work with modules. I think we need to revisit why we have both css_id
and input_id
and why css_id
gets a prefix.
If we can at least make it a suffix, then module name spaces (shiny::NS()
) can be applied
Thank you for investigating and elaborating @schloerke 🙏
I think we need to revisit why we have both
css_id
andinput_id
and whycss_id
gets a prefix.
This seems like the key question, I was guessing that perhaps there was some reason related to how SortableJS works, but I'm not familiar enough with the library to know.
I assume this is something that needs input from the other devs working on sortable and I should standby before working on a PR?
Hey @andrie & @schloerke,
I've spent a handful of hours trying to figure out what's going on here and it looks like the issue goes beyond just the update module, it appears that the handling of the shiny input ids in sortable is incompatible with shiny modules. I've added a contrived example in 5c9f4f7 that can be run with the console open. Clicking either of the buttons does not trigger the input methods.
I'm trying to hunt down the differences in how the
input_id
is handled in this package compared to others, but I'm wondering if anyone has a better understanding of what all needs to change to standardize the handling of theinput_id
argument internally such thatsortable
works in a modularized shiny app?Originally posted by @yogat3ch in https://github.com/rstudio/sortable/issues/95#issuecomment-1572834461