medialab / hyphe-browser

Browser version of Hyphe (WIP)
GNU Affero General Public License v3.0
29 stars 4 forks source link

Redirection modal shows up when clicking any link outside the domain of current webpage #185

Closed mydu closed 3 years ago

mydu commented 3 years ago

Should not detect as a redirect if it is a out page navigate

boogheta commented 3 years ago

Open links into a new tab is an acceptable solution for now, but it should be restricted to actual links to other webentities

boogheta commented 3 years ago

yeah, well done !

boogheta commented 3 years ago

I reopen as I can't seem to trigger the modal anymore for instance with cevipof.com

boogheta commented 3 years ago

Sorry, we still have some slight issues with redirections:

boogheta commented 3 years ago

This is now nearly perfect! Just one small little thing remains: when merging using the second choice, the new url is not overlined with the prefix until we refresh the page, because HyBro tries to map the url to the original prefixes of the webentity and not to the new ones that were just added, it could probably be fixed by updating manually the list of prefixes of the webentity displayed in the ram when getting the success result from calling the add_webentity_prefixes API.

boogheta commented 3 years ago

Ha and I just encountered a crash, after doing the above things, then displayed the DISCOVERED stack, clicked Sciences-Po.fr which redirected me to SciencesPo.fr and when selecting the first option and validating, I got a white screen with the following in the console:

lru.js?7b35:355 Uncaught TypeError: Cannot read property 'scheme' of null
    at lruObjectToString (lru.js?7b35:355)
    at match (lru.js?7b35:194)
    at eval (lru.js?7b35:206)
    at Array.map (<anonymous>)
    at longestMatching (lru.js?7b35:202)
    at eval (RedirectionModal.js?c50e:23)
    at mountMemo (react-dom.development.js?7f13:15443)
    at Object.useMemo (react-dom.development.js?7f13:15739)
    at useMemo (react.development.js?72d0:1521)
    at wrappedHook (react-hot-loader.development.js?c2cb:2798)
lruObjectToString @ lru.js?7b35:355
match @ lru.js?7b35:194
eval @ lru.js?7b35:206
longestMatching @ lru.js?7b35:202
eval @ RedirectionModal.js?c50e:23
mountMemo @ react-dom.development.js?7f13:15443
useMemo @ react-dom.development.js?7f13:15739
useMemo @ react.development.js?72d0:1521
wrappedHook @ react-hot-loader.development.js?c2cb:2798
MergePrefix @ RedirectionModal.js?c50e:22
renderWithHooks @ react-dom.development.js?7f13:14804
mountIndeterminateComponent @ react-dom.development.js?7f13:17483
beginWork @ react-dom.development.js?7f13:18597
callCallback @ react-dom.development.js?7f13:189
invokeGuardedCallbackDev @ react-dom.development.js?7f13:238
invokeGuardedCallback @ react-dom.development.js?7f13:293
beginWork$1 @ react-dom.development.js?7f13:23204
performUnitOfWork @ react-dom.development.js?7f13:22155
workLoopSync @ react-dom.development.js?7f13:22131
performSyncWorkOnRoot @ react-dom.development.js?7f13:21757
eval @ react-dom.development.js?7f13:11090
unstable_runWithPriority @ scheduler.development.js?3069:653
runWithPriority$1 @ react-dom.development.js?7f13:11040
flushSyncCallbackQueueImpl @ react-dom.development.js?7f13:11085
flushSyncCallbackQueue @ react-dom.development.js?7f13:11073
discreteUpdates$1 @ react-dom.development.js?7f13:21894
discreteUpdates @ react-dom.development.js?7f13:807
dispatchDiscreteEvent @ react-dom.development.js?7f13:4169
VM847 react_devtools_backend.js:2430 The above error occurred in the <MergePrefix> component:
    in MergePrefix (created by RedirectionModal)
    in div (created by RedirectionModal)
    in div (created by RedirectionModal)
    in div (created by RedirectionModal)
    in div (created by ModalPortal)
    in div (created by ModalPortal)
    in ModalPortal (created by Modal)
    in Modal (created by RedirectionModal)
    in RedirectionModal (created by BrowserTabContent)
    in div (created by BrowserTabContent)
    in BrowserTabContent (created by ConnectFunction)
    in ConnectFunction (created by BrowserTabsContainer)
    in div (created by BrowserTabsContainer)
    in BrowserTabsContainer (created by ConnectFunction)
    in ConnectFunction (created by Context.Consumer)
    in injectIntl(Connect(BrowserTabsContainer)) (created by BrowserLayout)
    in section (created by BrowserLayout)
    in div (created by BrowserLayout)
    in div (created by BrowserLayout)
    in BrowserLayout (created by BrowserContainer)
    in CorpusStatusWatcher (created by ConnectFunction)
    in ConnectFunction (created by BrowserContainer)
    in BrowserContainer (created by ConnectFunction)
    in ConnectFunction (created by Context.Consumer)
    in injectIntl(Connect(BrowserContainer)) (created by Context.Consumer)
    in Route (created by _default)
    in Switch (created by _default)
    in _default (created by App)
    in IntlProvider (created by App)
    in App (created by ConnectFunction)
    in ConnectFunction (created by App)
    in Router (created by ConnectedRouter)
    in ConnectedRouter (created by Context.Consumer)
    in ConnectedRouterWithContext (created by ConnectFunction)
    in ConnectFunction (created by App)
    in Provider (created by App)
    in App (created by HotExportedApp)
    in AppContainer (created by HotExportedApp)
    in HotExportedApp

React will try to recreate this component tree from scratch using the error boundary you provided, AppContainer.
mydu commented 3 years ago

@boogheta yes, these two issues should be fixed, the "Browse Webentity" side panel will update the entity right after submitting merge, but the "inquiry overview" won't remove/add the entity immediately until the global corpus listener trigger the changes

boogheta commented 3 years ago

Yes that sounds reasonable. And everything looks like working for good this time! Let's close the milestone \o/