Skip to content

Commit

Permalink
Merge pull request #5508 from nickgros/SWC-7038a
Browse files Browse the repository at this point in the history
Upgrade to SRC 3.3.10, fix e2e tests (again)
  • Loading branch information
jay-hodgson authored Aug 29, 2024
2 parents 4f86274 + 698950f commit 2ecb74d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
8 changes: 4 additions & 4 deletions e2e/files.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ const expectNoAccessPage = async (
expectTimeout: number = defaultExpectTimeout,
) => {
await expect(
page.getByRole('heading', {
name: 'Sorry, no access to this page.',
}),
page.getByText('You don’t have permission to view this.'),
).toBeVisible({ timeout: expectTimeout })
await expect(
page.getByText('You are not authorized to access the page requested.'),
page.getByText(
'This account has not been granted access to view this resource.',
),
).toBeVisible({ timeout: expectTimeout })
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"react-transition-group": "2.6.0",
"sass": "^1.63.6",
"spark-md5": "^3.0.2",
"synapse-react-client": "3.3.9",
"synapse-react-client": "3.3.10",
"universal-cookie": "^4.0.4",
"xss": "^1.0.15"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,22 @@ private void injectChildWidgetsIntoComponent() {

public void render(ReactElement<?> reactElement) {
this.reactElement = reactElement;
maybeCreateRoot();
injectChildWidgetsIntoComponent();

// This component may be a React child of another component. If so, we must rerender the ancestor component(s) so
// that they use the new ReactElement created in this render step.
ReactComponent<?> componentToRender = getRootReactComponentWidget();
if (componentToRender == this) {
// Resynchronize with the DOM
root.render(this.reactElement);
// Asynchronously schedule creating a root in case React is still rendering and may unmount the current root
Timer t = new Timer() {
@Override
public void run() {
maybeCreateRoot();
// Resynchronize with the DOM
root.render(reactElement);
}
};
t.schedule(0);
} else {
// Walk up the tree to the parent and repeat rerendering
componentToRender.rerender();
Expand Down
7 changes: 2 additions & 5 deletions src/main/webapp/Portal.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,14 @@
)
loadCss('https://fonts.googleapis.com/icon?family=Material+Icons')

let reactPath, reactDomPath, srcPath
let reactPath, reactDomPath

if (processEnvironment === 'production') {
reactPath = cdnEndpoint + 'generated/react.production.min.js'
reactDomPath = cdnEndpoint + 'generated/react-dom.production.min.js'
srcPath =
cdnEndpoint + 'generated/synapse-react-client.production.min.js'
} else {
reactPath = cdnEndpoint + 'generated/react.development.js'
reactDomPath = cdnEndpoint + 'generated/react-dom.development.js'
srcPath = cdnEndpoint + 'generated/synapse-react-client.development.js'
}

// TODO: Workaround for SWC-6664
Expand Down Expand Up @@ -196,7 +193,7 @@
loadJs(cdnEndpoint + 'generated/react-router-dom.min.js')
loadJs(cdnEndpoint + 'generated/universalCookie.min.js')
loadJs(cdnEndpoint + 'generated/react-bootstrap.min.js')
loadJs(srcPath) // We don't load SRC's scss because we include it in our own compiled scss
loadJs(cdnEndpoint + 'generated/synapse-react-client.production.min.js') // We don't load SRC's scss because we include it in our own compiled scss
loadJs(cdnEndpoint + 'generated/croppie.min.js')
loadCss(cdnEndpoint + 'js/diff/diffview.css')
loadCss(cdnEndpoint + 'generated/croppie.css')
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5924,10 +5924,10 @@ svg-path-sdf@^1.1.3:
parse-svg-path "^0.1.2"
svg-path-bounds "^1.0.1"

[email protected].9:
version "3.3.9"
resolved "https://registry.yarnpkg.com/synapse-react-client/-/synapse-react-client-3.3.9.tgz#ac59c8823d3d193bceffd674fb0b6da0b3564275"
integrity sha512-IbHV1a4DERpVe3QsNYtsgRFaGhn/CWVCJW+1e2/HIO7ZgKsu1lSsmV7yR//ZPKmR0PuRgI0IndJnFEl24mI12Q==
[email protected].10:
version "3.3.10"
resolved "https://registry.yarnpkg.com/synapse-react-client/-/synapse-react-client-3.3.10.tgz#71c7fff7904d07d44d832ca78ed7c1ad9169fd6e"
integrity sha512-Wm+T4bBZBvXMfxh8+59EV76yAyp+2693XUwx3PNBMHK4x1wTMc2H6D8NVAWDQqyKvg3nk0BSQ+GrH9eQiNOkqQ==
dependencies:
"@apidevtools/json-schema-ref-parser" "^9.1.2"
"@brainhubeu/react-carousel" "1.19.26"
Expand Down

0 comments on commit 2ecb74d

Please sign in to comment.