Skip to content

Commit

Permalink
fix(hub-common): handle undefined context.portal (#1245)
Browse files Browse the repository at this point in the history
* chore: add trigger for maint branches to release.yaml

* fix(hub-common): handle undefined context.portal

affects: @esri/hub-common
  • Loading branch information
mjuniper authored Sep 27, 2023
1 parent c2650a8 commit 3ae3795
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- beta
# - alpha disabled to allow push to alpha then merge to master w/o incurring a release
- next
- '[0-9]+.[0-9]+.x'
# Dont run if it's just markdown or doc files
paths-ignore:
- "**.md"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
},
"release": {
"branches": [
"+([1-9])?(.{+([1-9]),x}).x",
"master",
{
"name": "next",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/sites/HubSite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class HubSite
): IHubSite {
// ensure we have the orgUrlKey
if (!partialSite.orgUrlKey) {
partialSite.orgUrlKey = context.portal.urlKey;
partialSite.orgUrlKey = context.portal?.urlKey;
}
// extend the partial over the defaults
const pojo = { ...DEFAULT_SITE, ...partialSite } as IHubSite;
Expand Down
5 changes: 4 additions & 1 deletion packages/common/test/sites/HubSite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ describe("HubSite Class:", () => {
describe("static methods:", () => {
it("loads from minimal json", () => {
const createSpy = spyOn(HubSitesModule, "createSite");
const chk = HubSite.fromJson({ name: "Test Site" }, authdCtxMgr.context);
const chk = HubSite.fromJson(
{ name: "Test Site" },
unauthdCtxMgr.context
);

expect(createSpy).not.toHaveBeenCalled();
expect(chk.toJson().name).toEqual("Test Site");
Expand Down

0 comments on commit 3ae3795

Please sign in to comment.