Skip to content

Commit 95e873f

Browse files
committed
fix: load shared config from URL hash
1 parent 471978a commit 95e873f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/App.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ function App() {
5757
const [sidebarVisible, setSidebarVisible] = useState(true);
5858
const savingDisabledRef = useRef(false);
5959

60-
// Load config from URL if present
60+
// Load config from URL hash if present
6161
useEffect(() => {
62-
const params = new URLSearchParams(window.location.search);
62+
const hash = window.location.hash.slice(1); // remove leading '#'
63+
const params = new URLSearchParams(hash);
6364
const cfg = params.get('config');
6465
if (cfg) {
6566
const data = decodeConfig(cfg);
@@ -198,7 +199,7 @@ function App() {
198199

199200
const handleShareConfig = useCallback(() => {
200201
const data = encodeConfig({ globalParsingConfig, uploadedFiles });
201-
const url = `${window.location.origin}${window.location.pathname}?config=${data}`;
202+
const url = `${window.location.origin}${window.location.pathname}#config=${data}`;
202203
if (navigator?.clipboard?.writeText) {
203204
navigator.clipboard.writeText(url).then(() => {
204205
alert(t('shareConfig.copied'));

0 commit comments

Comments
 (0)