Skip to content

Conversation

@live627
Copy link
Contributor

@live627 live627 commented Aug 26, 2025

  • AJAX refactor: Replaced all jQuery $.ajax calls with the Fetch API and Promises.

    • Introduced a new smc_Request class with static fetch and fetchXML methods, supporting timeouts and credential options.
    • getServerResponse, getXMLDocument, and sendXMLDocument now use Fetch and return Promises, calling callbacks if provided.
  • Improved error handling: Uses Promise.reject and catches network errors; callbacks receive false on failure.

  • Popup and menu handling:

    • reqOverlayDiv and smc_PopupMenu now use fetch and native DOM methods instead of jQuery for content loading and event handling.

@live627 live627 added this to the 3.0 Alpha 5 milestone Aug 26, 2025
@jdarwood007
Copy link
Member

Can you also add the logic for handling JSON?
I had envisioned that we would replace our XML responses with JSON responses to take advantage of the more native handling of data. One step at a time, but if this is in place here, those steps become easier to do.

@sbulen
Copy link
Contributor

sbulen commented Aug 26, 2025

Almost like we need a response type, to make it easier to avoid rendering http themes.

@live627
Copy link
Contributor Author

live627 commented Aug 27, 2025

		smc_Request.fetch(url)
			.then(res => res.json())
			.then(function(jsonArray) { /* ... */ });

@jdarwood007
Copy link
Member

		smc_Request.fetch(url)
			.then(res => res.json())
			.then(function(jsonArray) { /* ... */ });

Fair enough. Mentioned because of the static function just for handling xml.

@live627
Copy link
Contributor Author

live627 commented Aug 27, 2025 via email

Copy link
Member

@jdarwood007 jdarwood007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good.

However, I can't complete a quick edit. All I did was click quick edit and then save. Never completes the save.

@live627
Copy link
Contributor Author

live627 commented Sep 11, 2025 via email

@live627
Copy link
Contributor Author

live627 commented Sep 11, 2025

Oh I see what's going on. It sends an object, which this new userland code treats as JSON. We must send a string so it sends the proper header.

@jdarwood007
Copy link
Member

That works but the Jump to never loads

@jdarwood007
Copy link
Member

With your jumpto changes, can that JavaScript now be called with a defer?

Some JS goals I had were to move everything into defer and use the calls for inline JavaScript to send them to the bottom of the page. Then look at doing noonce on all scripts and CSS. One step at a time would be if JS is getting updated, can it be deferred, which makes the later steps easier to accomplish later.

@live627
Copy link
Contributor Author

live627 commented Sep 13, 2025

I was planning to defer scripts in a future PR, but I decided to defer topic.js here 9ece101 so you would be able to see that each individual call in the templates would need to be deferred as well.

@jdarwood007
Copy link
Member

That's fine. As long as we are making the right progress towards where we can make that step happen more easily without rewriting them again. The ultimate goal for our JS in my mind is that our libraries can be loaded in the head with async, and the calls that set up the logic in the app are deferred until the end.

@jdarwood007
Copy link
Member

Safe to review again or do you have more incoming?

@live627
Copy link
Contributor Author

live627 commented Sep 14, 2025 via email

@jdarwood007
Copy link
Member

Two issue.

  1. Jump to a board and it takes you to the wrong url
  2. When you try to quick edit a post: Uncaught ReferenceError: oQuickModify is not defined

@live627
Copy link
Contributor Author

live627 commented Sep 14, 2025

@jdarwood007 jdarwood007 merged commit 0029430 into SimpleMachines:release-3.0 Sep 14, 2025
7 checks passed
@live627 live627 deleted the feat/req branch September 14, 2025 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants