Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Support host applications using HashRouter #230

Open
lordkada opened this issue Jun 29, 2020 · 1 comment
Open

Support host applications using HashRouter #230

lordkada opened this issue Jun 29, 2020 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@lordkada
Copy link

lordkada commented Jun 29, 2020

If I use the HashRouter, instead of the BroswerRouter, I get URLs like "http://localhost:3000/#/collections/new_collection/items/pippo" that break RichMarkdownEditor.scrollToAnchor:

index.tsx:405 Attempted to scroll to invalid hash: #/collections/new_collection/items/pippo DOMException: Failed to execute 'querySelector' on 'Document': '#/collections/new_collection/items/pippo' is not a valid selector.
    at RichMarkdownEditor.scrollToAnchor (http://localhost:3000/static/js/0.chunk.js:239564:32)
    at RichMarkdownEditor.componentDidMount (http://localhost:3000/static/js/0.chunk.js:239373:10)
    at commitLifeCycles (http://localhost:3000/static/js/0.chunk.js:200875:26)
    at commitLayoutEffects (http://localhost:3000/static/js/0.chunk.js:203847:11)
    at HTMLUnknownElement.callCallback (http://localhost:3000/static/js/0.chunk.js:181377:18)
    at Object.invokeGuardedCallbackDev (http://localhost:3000/static/js/0.chunk.js:181426:20)
    at invokeGuardedCallback (http://localhost:3000/static/js/0.chunk.js:181479:35)
    at commitRootImpl (http://localhost:3000/static/js/0.chunk.js:203589:13)
    at unstable_runWithPriority (http://localhost:3000/static/js/0.chunk.js:247300:16)
    at runWithPriority$1 (http://localhost:3000/static/js/0.chunk.js:192264:14)
    at commitRoot (http://localhost:3000/static/js/0.chunk.js:203431:7)
    at finishSyncRender (http://localhost:3000/static/js/0.chunk.js:202848:7)
    at performSyncWorkOnRoot (http://localhost:3000/static/js/0.chunk.js:202834:11)
    at http://localhost:3000/static/js/0.chunk.js:192318:28
    at unstable_runWithPriority (http://localhost:3000/static/js/0.chunk.js:247300:16)
    at runWithPriority$1 (http://localhost:3000/static/js/0.chunk.js:192264:14)
    at flushSyncCallbackQueueImpl (http://localhost:3000/static/js/0.chunk.js:192313:11)
    at flushSyncCallbackQueue (http://localhost:3000/static/js/0.chunk.js:192301:7)
    at scheduleUpdateOnFiber (http://localhost:3000/static/js/0.chunk.js:202241:13)
    at dispatchAction (http://localhost:3000/static/js/0.chunk.js:196821:9)
    at http://localhost:3000/static/js/main.chunk.js:1604:11
@lordkada lordkada added the bug Something isn't working label Jun 29, 2020
@tommoor
Copy link
Member

tommoor commented Jun 29, 2020

Hi @lordkada – I can't class this as a bug in the editor as the editor is using fragments as you would expect them to be used – to identify a heading/section in a page. It sounds like your host application is "abusing" fragments for it's entire routing system, which is not really best practice.

I don't have time to address this usecase, however if you have suggestions on how it might be changed to support your router and want to PR a solution I'm very open to that.

@tommoor tommoor added enhancement New feature or request help wanted Extra attention is needed and removed bug Something isn't working labels Jun 29, 2020
@tommoor tommoor changed the title Failed to execute 'querySelector' if using HashRouter Support host applications using HashRouter Jun 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants