Not sure I can isolate this code from the issue, but I’m getting closer. FYI, this is version 7.2.10 of the platform. I’m still not getting the entire entity loaded. It seems like it is loading “_minimal” rather than “_local”, even though I specify that as the view. Here’s the entity code:
export class Webusers extends BaseIdentityIdEntity {
static NAME = "pasweb_Webusers";
uuid?: any | null;
login?: string | null;
password?: string | null;
email?: string | null;
usertype?: WebUserTypes | null;
customer?: Customers | null;
mailer?: Mailers | null;
custpage?: string | null;
broker?: Brokers | null;
owner?: Customers | null;
salesrep?: Salesreps | null;
}
export type WebusersViewName = "_base" | "_local" | "_minimal";
export type WebusersView<V extends WebusersViewName> = V extends "_base"
? Pick<
Webusers,
"id" | "login" | "password" | "email" | "usertype" | "custpage"
>
: V extends "_local"
? Pick<
Webusers,
"id" | "login" | "password" | "email" | "usertype" | "custpage"
>
: never;
In the debugger, here’s my view of the loaded entity (after the load statement and a status of “DONE”):

As you can see, there are no fields in the object. The code that loaded it is now:
@action
doWebuserLookup(userName: string | undefined) {
this.performingWebuserLookup = true;
this.webUsers = collection<Webusers>(Webusers.NAME, {
view: "_minimal",
filter: {
conditions: [
{property: "login", operator: "=", value: userName || null}
]
},
loadImmediately: false
})
this.webUsers.load()
.then(
action(() => {
const {id} = this.webUsers.items[0];
if (id != null) {
this.webUser = instance<Webusers>(Webusers.NAME, {
view: "_local",
loadImmediately: false
});
console.log("ID to load is: " + id);
this.webUser.load(id);
this.reactionDisposer = reaction(
() => { return this.webUser.item },
() => {
this.performingWebuserLookup = false;
}
)
}
})
)
.catch(
action(() => {
this.performingWebuserLookup = false;
message.error(this.props.intl.formatMessage({ id: "secureArea.userNotFound" }));
})
);
}
I filter in a collection, then load the first item in the collection. That’s the only way I’ve found to get a search on a non-ID field to complete. I did try view: “_local” on the collection, but it did not load the entire view either. Obviously I would like to remove the second round trip.
Why are my fields not loading based on the view?
I will try to generate a minimal example, but I really am a noob at React so I’m not sure I can.