• Resolved Vjekoslav Vučić

    (@vjekoslavvucic)


    Hi!
    I have a problem with version 6.3.5 of the plugin when switching from the “List” view to the “Day” view.
    The problem occurs when I scroll several pages forward on the “List” view, on the “Event Bar” or on the navigation at the footer of the “List” view.
    Occurs only when the selected day on the Calendar control does not have enough events for the page the “List” is currently on.
    For example day has only 5 events, the list shows 12 events by default, I switch the list to “Upcoming events” – I scroll for a few pages, for example to page 5.
    If I then try to switch to the “Day” view, I get the message:

    “No events scheduled for March 27, 2024. Jump to the next upcoming events.”

    After that, I have to select a date on the “Calendar” control in the “Events Bar” and the events are displayed again.

    The paged url parameter remained in the browser address:
    https://test1.athelingsoft.com/?post_type=tribe_events&eventDisplay=day&paged=5

    Through Debugging I found a dirty workaround in the file:
    \wp-content\plugins\the-events-calendar\src\resources\js\views\manager.js
    in a js function
    obj.onLinkClick = function( event ) { … }

    // Line 329
    // change from
    var url = $link.attr( 'href' );
    // to
    var url = ($link.attr("href")).indexOf("eventDisplay=day") > -1 ? ($link.attr("href")).replace(new RegExp('[?&]' + 'paged' + '=^&#?$'), '$1').replace(new RegExp('([?&])' + 'paged' + '=[^&]*&'), '$1') : $link.attr("href");

    The regex pattern is borrowed from Stackoverflow, question 1634748, and tested on regex101.
    This way I delete the “paged” URL parameter only when switching from the “List” to the “Day” view, when there is an “eventDisplay” URL parameter with the value “day” – “eventDisplay=day”.
    Of course, I did the same in the manager.min.js file. The text is there:

    url = $(this).attr("href"),
    // changes with
    url = ($(this).attr("href")).indexOf("eventDisplay=day") > -1 ? ($(this).attr("href")).replace(new RegExp('[?&]' + 'paged' + '=[^&#](#.)?$'), '$1 ').replace(new RegExp('([?&])' + 'paged' + '=[^&]*&'), '$1') : $(this).attr("href"),

    I will mention that I did this the dirty way. After every plugin update, I have to repeat the replacement.

    Of course, I have been able to perform basic troubleshooting steps from “Sticky”.
    I set up a test site and activated theme Twenty Twenty-Two, the TEC plugin, FIFU and my plugin that I use for customizing.
    When only TEC remains active, the same problem occurs, the behavior is the same, and it looks like a js bug to me.
    When switching from the “List” to the “Day” view, the url parameter “page/paged” is sent in request, which creates a problem when changing the view.

    Questions!
    Does anyone have the same problem as I have?
    Is there any better solution, or are there some improvements for my workaround?

    Regards

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @vjekoslavvucic!

    The URL where you are experiencing the issue, https://test1.athelingsoft.com/?post_type=tribe_events&eventDisplay=day&paged=5, would display the 5th page of listed events on the current day. Because you do not have a 5th page of events on the given day, no events are listed. Clicking the day view link on our calendar should always send you to the 1st page of the day view and I found that to be true when I tested things on my sandbox.

    I can also see that when you select the list view on your calendar it sends you to the last numbered page of the list you visited. This is also not the expected outcome. Selecting the list view should send you to the 1st page of the list view. I confirmed the expected outcome in my testing.

    It is quite possible that you have a plugin or theme conflict going on here and the next thing to do would be a conflict test: https://theeventscalendar.com/knowledgebase/testing-for-conflicts/

    It is also possible that you have a caching conflict going on here. Please try excluding our folder from caching: https://theeventscalendar.com/knowledgebase/caching-basics/

    Thanks!
    John

    Thread Starter Vjekoslav Vučić

    (@vjekoslavvucic)

    Hi @jdbeacham!
    I have tested for plugin or theme conflict but the behavior is the same.
    I have deleted all plugins, not just deactivated ones. The active theme is Twenty Twenty, and after switching to the day view I can see that the URL parameter “paged” is still here. I don’t use any caching because the site I have created today is just for this testing.
    Only one plugin is installed and activated – The Events Calendar.
    Do you have any other ideas?
    Thanks for your help!
    Vjekoslav

    Thread Starter Vjekoslav Vučić

    (@vjekoslavvucic)

    I haven’t found the source of the bug because it’s a lot of nice code that someone else wrote.
    But I found a better workaround.
    I added a filter to functions.php:

    add_filter( "tribe_events_views_v2_view_list_public_views", function ($public_views) {
    	$url_day = remove_query_arg( 'paged', $public_views['day']->view_url );
    	$public_views['day']->view_url = $url_day;
    	return $public_views;
    });

    Maybe someone will come forward with a better workaround.
    Regards

    Hello @vjekoslavvucic!

    Thanks for continuing to work on this.

    We did some more testing and have been able to replicate the issue you are reporting. We have also created a bug ticket for the issue and will update this thread when there are any, well, updates! 🙂

    I want to thank you again for looking into this, your clear explanations and for sharing your workarounds.

    Best!
    John

    #BTRIA-2332

    Plugin Support Darian

    (@d0153)

    Hello @vjekoslavvucic!

    Just to add, we prioritize bugs by taking into consideration the number of users impacted as well as how the bug impacts one’s ability to use the plugin. We don’t have a specific timeline as to when this issue will be resolved but trust that our team is aware. Our team communicates updates and bug fixes in our newsletter and via our changelog.

    We’re happy to help if any other questions are coming up around this topic, otherwise, I’ll go ahead and close this ticket.

    Thanks again for reporting this issue and for using The Events Calendar! Have a great day.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘View switching from the “List” to the “Day” possible js bug’ is closed to new replies.