Compare commits

...

1 Commits

Author SHA1 Message Date
Joe Cheng
4e8e328a37 When initializing inputs, make sure their values actually get to server
Partial fix for #1791
2020-07-17 15:11:50 -07:00
6 changed files with 19 additions and 5 deletions

View File

@@ -626,7 +626,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
var jsonValue = JSON.stringify(value);
if (opts.priority !== "event" && this.lastSentValues[inputName] && this.lastSentValues[inputName].jsonValue === jsonValue && this.lastSentValues[inputName].inputType === inputType) {
if (opts.priority !== "event" && opts.priority !== "initialize" && this.lastSentValues[inputName] && this.lastSentValues[inputName].jsonValue === jsonValue && this.lastSentValues[inputName].inputType === inputType) {
return;
}
@@ -779,6 +779,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
if (opts && typeof opts.priority !== "undefined") {
switch (opts.priority) {
case "initialize":
case "deferred":
case "immediate":
case "event":
@@ -6171,6 +6172,12 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
inputItems[effectiveId] = {
value: binding.getValue(el),
opts: {
// The "initialize" priority is like a hybrid of "immediate" and
// "event". Like "event", the input value is sent even if it is the
// same as the last-known value for this input (i.e. no dedupe).
// But unlike "event", and like "immediate", it's free to be batched
// up with other input values and sent at once.
priority: "initialize",
immediate: true,
binding: binding,
el: el

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -146,6 +146,12 @@ function initShiny() {
inputItems[effectiveId] = {
value: binding.getValue(el),
opts: {
// The "initialize" priority is like a hybrid of "immediate" and
// "event". Like "event", the input value is sent even if it is the
// same as the last-known value for this input (i.e. no dedupe).
// But unlike "event", and like "immediate", it's free to be batched
// up with other input values and sent at once.
priority: "initialize",
immediate: true,
binding: binding,
el: el

View File

@@ -231,7 +231,7 @@ var InputNoResendDecorator = function(target, initialValues) {
const { name: inputName, inputType: inputType } = splitInputNameType(nameType);
const jsonValue = JSON.stringify(value);
if (opts.priority !== "event" &&
if ((opts.priority !== "event" && opts.priority !== "initialize") &&
this.lastSentValues[inputName] &&
this.lastSentValues[inputName].jsonValue === jsonValue &&
this.lastSentValues[inputName].inputType === inputType) {
@@ -384,6 +384,7 @@ function addDefaultInputOpts(opts) {
if (opts && typeof(opts.priority) !== "undefined") {
switch (opts.priority) {
case "initialize":
case "deferred":
case "immediate":
case "event":