mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) When searching, use formatter.formatAny() to handle values of invalid type.
Summary: This turns out necessary because ReferenceList columns are formatted using the formatter of the associated visibleCol. This works correctly in dedicated widgets, but in generic code (like SearchModel here), this formatter needs to handle unexpected values (of type ReferenceList). Without the fix, it produces JS errors when search reaches a RefList:<Date> column. A better fix would allow a formatter to know that it expects a ReferenceList, AND to know how to format each value of it, but that's a bigger question that's outside the scope of this fix. Test Plan: Includes a browser test which reproduces the bug. Reviewers: cyprien Reviewed By: cyprien Differential Revision: https://phab.getgrist.com/D3195
This commit is contained in:
parent
c1de16aee7
commit
e0fb281eba
@ -266,7 +266,7 @@ class FinderImpl implements IFinder {
|
|||||||
const value = this._sectionTableData.getValue(rowId, displayCol.colId.peek());
|
const value = this._sectionTableData.getValue(rowId, displayCol.colId.peek());
|
||||||
|
|
||||||
// TODO: Note that formatting dates is now the bulk of the performance cost.
|
// TODO: Note that formatting dates is now the bulk of the performance cost.
|
||||||
const text = formatter.format(value);
|
const text = formatter.formatAny(value);
|
||||||
return this._searchRegexp.test(text);
|
return this._searchRegexp.test(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1371,12 +1371,12 @@ export class ActiveDoc extends EventEmitter {
|
|||||||
options: ApplyUAOptions = {}): Promise<ApplyUAResult> {
|
options: ApplyUAOptions = {}): Promise<ApplyUAResult> {
|
||||||
|
|
||||||
const client = docSession.client;
|
const client = docSession.client;
|
||||||
this._log.debug(docSession, "_applyUserActions(%s, %s)", client, shortDesc(actions));
|
this._log.debug(docSession, "_applyUserActions(%s, %s)%s", client, shortDesc(actions),
|
||||||
|
options.parseStrings ? ' (will parse)' : '');
|
||||||
this._inactivityTimer.ping(); // The doc is in active use; ping it to stay open longer.
|
this._inactivityTimer.ping(); // The doc is in active use; ping it to stay open longer.
|
||||||
|
|
||||||
if (options.parseStrings) {
|
if (options.parseStrings) {
|
||||||
actions = actions.map(ua => parseUserAction(ua, this.docData!));
|
actions = actions.map(ua => parseUserAction(ua, this.docData!));
|
||||||
this._log.debug(docSession, "_applyUserActions(%s, %s) (after parsing)", client, shortDesc(actions));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options?.bestEffort) {
|
if (options?.bestEffort) {
|
||||||
|
Loading…
Reference in New Issue
Block a user