Skip to content

Conversation

@AndyatFocallocal
Copy link

@sylque I’ve been able to update Docuss to work with the new Discourse. Would you like to update your original repo?

https://github.com/focallocal/dcs-discourse-plugin

It's live on our platform which we've rebuilt (again) and got it finally nearly ready to launch: https://publichappinessmovement.com/

eachirei and others added 30 commits June 25, 2021 15:54
Fix access to SiteSettings
Better fix for SiteSettings to ensure it doesn't break in other places
Reverting to last known working version, without ember updates
Update docuss.js.es6. Reverting to last known working version, without ember updates
The map jump is happening inside the React app, not from Discourse
elements pushing it. Need to debug the fl-maps React app instead.
- Add click handler to detect sidebar clicks when in Docuss layout
- Removes dcs-trigger-id, dcs-layout, and dcs-interact-mode params
- Navigates to clean URL to close Docuss split view
- Resolves issue where clicking sidebar in thread view didn't close Docuss
When on a topic page (layout 3) after creating a post, clicking the splitbar
slider should navigate away from the topic to close Docuss, not just toggle
the showRight query param.

- Detect when on topic.* routes and user wants to close Docuss
- Navigate back to tags intersection page or /latest
- Prevents 'Missing pathname' error for layout 1 transitions
The topic data object was being included in the dcsRoute passed to didTransition(),
which failed validation since layout 3 only accepts: layout, pageName, triggerId,
interactMode (and optional hash).

- Build dcsRoute WITHOUT topic data for validation
- Add topicData to iframe.currentRoute AFTER didTransition succeeds
- Topic data is still sent to fl-maps via postMessage as before
- Prevents DocussError when navigating to newly created topics
- Added window.dcsSaveTimeline() to export timing log to a file
- Added timing logs to onDidTransition, onDidTransition2, onDidTransition3
- Logs tag loading wait time and success/failure
- Exposed window.dcsTimingLog() globally for cross-module access
- dcsTimingOff() now auto-saves to localStorage and downloads file
- Logs persist in localStorage (last 10 sessions)
- New commands: dcsTimingLogs(), dcsTimingExport(), dcsTimingClearAll()
- dcsTimingLogs() shows all saved sessions
- dcsTimingExport() downloads all sessions as one file
- Timing persists across page reloads using localStorage
- dcsTimingStart(hours) - Start collecting for specified duration (default 24h)
- Auto-saves events every 5 seconds and on page unload
- Caps at 10,000 events to prevent localStorage overflow
- Auto-expires after specified duration
- dcsTimingStatus() - Check collection state and time remaining
- dcsTimingExport() - Download all collected events
- dcsTimingStop() - Stop and download
- Backwards compatible: dcsTimingOn/Off still work
When navigating to /docuss/m_map, the route context['page'] may be
empty on initial load, causing the iframe to default to the homepage
(m_home) before loading the correct page.

This fix extracts the pageName directly from window.location.pathname
if the route context is empty, preventing the homepage flash.

The existing fallback in DcsIFrame.js.es6 didTransition() is kept as
a safety net but should no longer be triggered for normal navigation.
Problem: dcsOpenForm postMessage sent before iframe listener is ready
on Brave, causing form2/form3 pages to not open the form modal

Solution: Send dcsOpenForm immediately, then retry at 500ms and 1500ms
to ensure the message is received once the iframe listener is active.
…ments

RACE CONDITION FIX:
- Add routeSequenceId counter that increments on each route transition
- Include routeSequenceId in postDiscourseRoutePushed (m2) message
- Validate incoming routeSequenceId in onSetRouteProps to skip stale messages
- Add recovery fallback: ensure layout is correctly applied when skipping stale messages

TIMING IMPROVEMENTS:
- Clear all pending timers and state at start of each route transition
- Reduce connection check interval to 100ms for faster response
- Reduce spinner delay to 300ms for better UX
- Add recovery timeout with iframe reload as fallback
- Hide spinner when starting new navigation to prevent visual glitches

STATE MANAGEMENT:
- Clear _docussPendingLayout on new navigation
- Clear _docussConnectionTimer and _docussRecoveryTimer
- Reset _docussSpinnerShown flag

These changes prevent the white page bug that occurred when navigating
quickly between map and forum pages. The race condition happened when
postSetRouteProps messages arrived after the user had already navigated
to a different route.
- Add browser/device detection to timing logs (browser, OS, screen size, viewport, connection)
- Increase MAX_CONNECTION_WAIT from 2000ms to 3000ms for slow mobile connections
- Increase tag wait retries from 15 to 25 (3s to 5s total)
- Improve dcsOpenForm retry with 4 attempts at 0ms, 500ms, 1500ms, 3000ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants