I believe that for Enterprise accounts they are multiple accounts/workspaces held under the same account. Looking further it seems like the workspaceID for me is just my account ID as a hash.
I think this is the truth It is accidentally setting the localstorage to indicate that we have seen the “Workplace” onBoarding, and not the “Personal”.
Specifically. It is this part of the code that makes the mistake I believe. It’s a bit hard because of being minified and I am assuming a bit of what the variables are.
Both the personal and workspace is checked, with “t” (or “d” as the workspaceID) being undefined for personal.
u = ex(i.Personal).getHasSeenOnboardingDate,
p = (0, h.ec) (h.F_.isBusinessWorkspace),
f = ex(i.Workspace, d).getHasSeenOnboardingDate,
It’s important to note here that “t” is the variable used to determine if the workspaceId is used
i is an enum defined simply as:
i: {…}
Personal: "chat"
Workspace: "workspace"
ex = function (e, t) {
var a = (0, g.useCallback) (function () {
em.m.setItem(em.F.WorkspaceOnboarding, new Date().toLocaleDateString('en-CA', {
year: 'numeric',
month: '2-digit',
day: '2-digit'
}), {
workspaceId: null != t ? t : void 0,
workspaceScope: e
})
}, [
e,
t
]),
I set a breakpoint and for some reason it is indeed setting it as a workspace ID and not as personal.
It’s called from here:
function ev(e) {
var t = e.onClose,
a = e.scope,
n = ex(a, (0, h.ec) (h.F_.workspaceId)).setHasSeenOnboarding,
s = (0, g.useCallback) (function () {
t(!0),
n()
}, [
t,
n
]);
return a === i.Personal ? (0, c.jsx) (ey, {
onSubmit: s
}) : (0, c.jsx) (ek, {
onSubmit: s
})
}
Specifically:
n = ex(a, (0, h.ec) (h.F_.workspaceId)).setHasSeenOnboarding,
Looks like h.F_.workspaceId should be undefined (to indicate a personal account) but it’s always truthy (I think)
Looks like it is meant to separate between personal and business accounts based on the h.F_ values. So I’m guessing “workspaces” are shared conversations.
F_: {…}
accountUserId(Y)
businessWorkspace(Y)
businessWorkspaceId(Y)
features(Y)
hasCustomerObject(Y)
hasMultipleWorkspaces(Y)
hasPaidSubscription(Y)
isAdmin(Y)
isBusinessWorkspace(Y)
isOwner(Y)
isPersonalWorkspace(Y)
lastActiveSubscription(Y)
useHasClaimedFreeTrial(Y)
wasPaidCustomer(Y)
workspaceId(Y)
workspaces(Y)
It could also be that they are reading/separating it incorrectly. It’s a function from a different location and I think doing this is fruitless
s = (0, o._) ((0, g.useState) (0), 2),
r = s[0],
l = s[1],
r is always false with the hashed key, but properly returns the date when using the non-hashed version.
I believe it’s either A) They forgot to consider if there’s a hash when checking or B) They are incorrectly adding the hash when it’s a chat and not a workspace. Could even be both A and B. This is not harmonized at all.
So. That was fun. Even if nobody cares and nothing will happen and this bug will probably never get acknowledged. But. Yay…
I could also be wrong here. Still a reactjs newbie.
The strange thing is how they have labelled it as “workspaceOnBoarding” (resolves to WorkspaceOnboarding: "oai/apps/hasSeenOnboarding"
)which leads me to believe that they want to consolidate the two together but didn’t. Or half-way did. Whatever.
UPDATE
This has been fixed with some new changes and general cleanup. (Including workspaceOnboarding → Onboarding)
var a = (0, m.useCallback) (function () {
ef.m.setItem(ef.F.Onboarding, new Date().toLocaleDateString('en-CA', {
year: 'numeric',
month: '2-digit',
day: '2-digit'
}), {
workspaceId: null != t ? t : void 0,
workspaceScope: e
})
}, [
e,
t
]),
from
n = ex(a, (0, h.ec) (h.F_.workspaceId)).setHasSeenOnboarding,
to
s = ex(a, a === i.Workspace ? n : void 0).setHasSeenOnboarding,