Skip to content

Commit

Permalink
MWPW-135191 Hide caas link that has a query param (#1114)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischrischris authored Aug 17, 2023
1 parent bca91e1 commit 84a1801
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .eslintrc-code-compatibility.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
root: true,
extends: ['plugin:compat/recommended', 'plugin:ecmalist/recommended'],
extends: ['plugin:compat/recommended', 'plugin:ecmalist/recommended', 'plugin:react-hooks/recommended'],
settings: { es: { aggressive: true } },
env: { browser: true, mocha: true },
parser: '@babel/eslint-parser',
Expand Down
12 changes: 8 additions & 4 deletions libs/blocks/caas-config/caas-config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react-hooks/exhaustive-deps */
/* global ClipboardItem */
import {
createContext,
Expand Down Expand Up @@ -564,7 +565,7 @@ const FilterPanel = ({ tagsData }) => {
<${TagSelect} id="customFilterTag" options=${allTags} label="Filter Tag" singleSelect />
<//>
<!-- End nested multifield -->
<${FormInput} label="Opened on load" name="openedOnLoad" type="checkbox" />
<//>
`;
Expand Down Expand Up @@ -739,8 +740,10 @@ const CopyBtn = () => {
};

const getUrl = () => {
const url = window.location.href.split('#')[0];
return `${url}#${utf8ToB64(JSON.stringify(state, fgKeyReplacer))}`;
const url = new URL(window.location.href);
url.search = '';
url.hash = utf8ToB64(JSON.stringify(state, fgKeyReplacer));
return url.href;
};

const copyConfig = () => {
Expand Down Expand Up @@ -893,7 +896,8 @@ const Configurator = ({ rootEl }) => {
setIsCaasLoaded(true);
})
.catch((e) => {
/* c8 ignore next */
/* c8 ignore next 2 */
// eslint-disable-next-line no-console
console.log('Error loading script: ', e);
});
}, []);
Expand Down
2 changes: 1 addition & 1 deletion libs/blocks/caas/caas.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
a[href*='/tools/caas#'] {
a[href*='/tools/caas#'], a[href*='/tools/caas?'] {
visibility: hidden !important;
}

Expand Down
1 change: 1 addition & 0 deletions libs/blocks/faas-config/faas-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ const RequiredPanel = () => {
};

if (!Object.keys(langOptions).length) {
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
getObjFromAPI('/faas/api/locale').then((data) => {
data.forEach((l) => {
Expand Down
1 change: 1 addition & 0 deletions libs/hooks/useHover.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { useEffect, useState, useRef } from '../deps/htm-preact.js';
const useHover = ({ refToAttachTo = null, useMouseLeave = false } = {}) => {
const [hoverState, setHoverState] = useState(false);

// eslint-disable-next-line react-hooks/rules-of-hooks
const ref = refToAttachTo || useRef(null);

const handleMouseOver = (ev) => setHoverState({ hovering: true, event: ev });
Expand Down

0 comments on commit 84a1801

Please sign in to comment.