Skip to content

Commit

Permalink
FIX: Fields not visible (#1934)
Browse files Browse the repository at this point in the history
* Some fields were hidden after opening a screen when the screen was open with a hyperlink from a grid.

---------

Co-authored-by: Petr Hrehorovsky <83349812+washibana@users.noreply.github.com>
  • Loading branch information
JindrichSusen and washibana committed Sep 20, 2023
1 parent 15ceef8 commit 41f73dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ export class FormBuilder extends React.Component<{
return <></>;
}

const isHidden =
(!getRowStateAllowRead(property, rowId || "", property.id) ||
getRowStateMayCauseFlicker(property)) && !!row;
let mayCauseFlicker = getRowStateMayCauseFlicker(property);
let rowStateAllowRead = getRowStateAllowRead(property, rowId || "", property.id);
const isHidden = (!rowStateAllowRead || mayCauseFlicker) && !!row;

if (property.column === "CheckBox") {
return (
Expand Down
12 changes: 9 additions & 3 deletions frontend-html/src/model/entities/RowState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ import { getEntity } from "model/selectors/DataView/getEntity";
import { getApi } from "model/selectors/getApi";
import { getSessionId } from "model/selectors/getSessionId";
import { flashColor2htmlColor } from "utils/flashColorFormat";
import { IRowState, IRowStateColumnItem, IRowStateData, IRowStateItem } from "./types/IRowState";
import { IRowState, IRowStateColumnItem, IRowStateItem } from "./types/IRowState";
import { FlowBusyMonitor } from "utils/flow";
import { handleError } from "model/actions/handleError";
import { visibleRowsChanged } from "gui/Components/ScreenElements/Table/TableRendering/renderTable";
import { getDataSource } from "model/selectors/DataSources/getDataSource";
import { CancellablePromise } from "mobx/lib/api/flow";

const defaultRowStatesToFetch = 100;

Expand All @@ -51,7 +50,14 @@ export class RowState implements IRowState {
if (!visibleRows || dataSource.identifier !== visibleRows.dataSourceId) {
return;
}
this.visibleRowIds = visibleRows.rowIds;
// The event is sometimes raised with no ids, then some ids, then no ids...
// Ignoring the no ids makes sure that the triggerLoadDebounced will not run with no ids
// when some are actually visible. This problem was not really observed so may be the
// "if" statement could be removed if this results in more RowState calls then necessary.
if(visibleRows.rowIds.length > 0){
this.visibleRowIds = visibleRows.rowIds;
}
this.triggerLoadDebounced();
});
}

Expand Down

0 comments on commit 41f73dd

Please sign in to comment.