Found a few bugs when loading via server side ajax
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- frontend
Research direction
Start with StateRestore.ts lines 751-758 and StateRestoreCollection.ts lines 641-647 and 878. Reproduce the refresh scenario using the linked ajax examples, checking whether loaded states can be updated and whether the function-style load callback fires. Done means server-loaded states retain the correct predefined status and the documented update behavior works after refresh.
Written by the indexing model from the issue text.
Description
Have been having issues trying to get StateRestore to load all states via server side Ajax call
using the function style ajax calls per See Here to control all the server side saving
I have never seen if (data.action === 'load') option ever fire... so I resorted to using the ajax stateRestore option on initial load
as See Here
Everything works until browser refresh and then you can't update any of the existing based on this area in StateRestore.ts (line 751-758)
//If the state is predefined there is no need to save it over ajax or to local storage
if (this.s.isPreDefined) {
if (passedSuccessCallback) {
passedSuccessCallback.call(this);
}
return;
}
what occurs is all the states are set to isPreDefined: true even for ajax loading
There is also a typo in StateRestoreCollection.ts where you in line 641-647
currState.stateRestore = {
isPredefined: false,
state: id,
tableId: this.s.dt.table().node().id
};
It s/b isPreDefined not isPredefined
I looked at your source code and I don't ever see a callback for the load process, and all the function Ajax examples don't ever load server side.
Your above initialisation/ajax.html example fails the same way
Steps:
1: Load a new state and try all the options (Rename, Update, Remove) they all fire a callback to server
2: Keep at least one state and re-fresh browser.
3: You can do all options except Update (check and all the loaded states are now IsPreDefined)
In my case, I never have preDefined: in the DataTable settings... so I turned off the true condition in StateResotrCollection.ts
_addPreDefined (line 878)
So in closing,
A) is there a way to load via function call Ajax from the server or
B) you should change the _addPreDefined call to add a boolean to set that isPreDefined to false for Ajax loads
Thanks
- Dominant language
- JavaScript
- Stars
- 3
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DataTables/StateRestore
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
DataTables/StateRestore#8 · 6 comments ·
All issues in DataTables/StateRestore
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 92/100
PedestrianDynamics/pyFDS-Evac#476 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
aiko-chan-ai/DiscordBotClient#380 ·
-
Offisielle trærOpen
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 3 days
-
Add: Atlas TVOpenchannels:add check:passed
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 4 days