R链接中的闪亮应用程序加载引发RestoreContext错误,但是仍然有效吗? [英] R Shiny app load from link throws RestoreContext error yet still works?
问题描述
我有两个正在处理的Shiny应用程序,我希望能够使用App 1为App 2生成一些输入(在本例中为基因名称).通过shiny
的parseQueryString()
解析App 1的基因名称,然后对App 2进行任何操作.
I have two Shiny apps that I'm working on, and I'd like to be able to use App 1 to generate some input to App 2(in this case a gene name). The gene name from App 1 is parsed via shiny
's parseQueryString()
, and then does whatever in regards to App 2.
To simulate App 1, I just have a simple HTML file(I got the link structure from this webinar about bookmarking):
<html>
<body>
<div>
<a href="http://10.59.24.60:3800/quux/?_inputs_&gene=IL23R">Send to targetProfiler</a>
</div>
</body>
</html>
其中"quux"是App 2的名称.我单击链接,将其带到App 2,然后它在数据库中搜索基因名称,等等.但是,我在右下角收到shiny
错误消息
Where "quux" is the name of App 2. This works perfectly fine; I click the link and am brought to App 2, and then it searches for the gene name in a database, etc. However, I get a shiny
error message in the bottom right corner
在其中读取到shiny
认为它实际上未能解析URL参数.
in which it reads that shiny
thinks it failed to parse the URL param, when in fact it did.
处理此问题的服务器代码是这样设置的:
The server code that handles this is set up like this:
observe({
#make sure its first time loading app
if (!vals$firstLoad) {
return (NULL)
}
query <- parseQueryString(session$clientData$url_search)
# browser()
# Only continues when there is gene names to be queried in the URL
req(query[['gene']])
# Get URL parameter
inputText <- paste0(unique(splitByComma(query[['gene']])), collapse = ',') # Only unique terms
#do stuff with inputText
#...
#...
是否有一种方法可以抑制此警告/错误?还是shiny
认为实际上没有正确解析URL参数,这是怎么做的呢?
Is there a way to suppress this warning/error? Or what is being done wrong that shiny
thinks that it hasn't properly parsed the URL parameter, when in fact it has?
推荐答案
已标记的值在URL中编码为JSON. IL23R
不是没有双引号的有效JSON字符串. gene="IL23R"
应该可以工作,或者也可以像gene=%22IL23R%22
一样进行百分比编码.
Bookmarked values are encoded in a URL as JSON. IL23R
isn't a valid JSON string without double quotes. gene="IL23R"
should work, or also percent-encoded like gene=%22IL23R%22
.
这篇关于R链接中的闪亮应用程序加载引发RestoreContext错误,但是仍然有效吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!