question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sheet: loosing data when working fast, possible bug?

See original GitHub issue

Describe the bug

Some of our users work fast in a sheet, all changes look ok, possitive growl feedback, but after F5 a lot of changes are reverted.

client side I do <p:ajax event="change" update="@none" listener="#{perceelSheetController.cellChangeEvent}"

serverside I have a sessionscoped bean, that stores updates, handles errors and applies client update logic.

Serverside I tried synchronizing, locking. Clientside I tried eliminating other events than change, updating the whole sheet in onchange seems to help but leads to a hard to fix scrolling problem.

I cannot yet exactly pinpoint the problem, not even after extensice debugging client and server, but it looks like a client side problem where the browser sends data before everything that should be completed is completed.

Do some other users of sheet experience problems like this? Could I overlook something crucial?

Reproducer

Sorry, no reproducer yet

PrimeFaces Extensions version

11.0.2

JSF implementation

Mojarra

JSF version

2.3

Affected browsers?

firefox

Steps to reproduce the behavior

No response

Expected behavior

updates applied and saved

Sample XHTML

            <pe:sheet id="sheet" widgetVar="sheetWidget" value="#{perceelSheetController.percelen}" var="row" rowStyleClass="#{row.id == null ? 'nieuw' : ''}"
                      rowKey="#{perceelSheetController.getRowKey(row.id)}" showRowHeaders="true" 
                      resizableCols="true" resizableRows="true" filteredValue="#{perceelSheetController.filtering.filtered}"
                      readOnly="#{not accessController.mayEdit()}">

                <p:ajax event="change" update="@none" listener="#{perceelSheetController.cellChangeEvent}" 
                        onerror="window.setTimeout(function() {focusFirstSheetError('sheetWidget');}, 200);"/>
                <p:ajax event="cellSelect" update="@none" listener="#{perceelSheetController.cellSelectEvent}" disabled="#{perceelSheetController.isChangeErrors()}"/>

Sample Bean

    public void cellChangeEvent(final SheetEvent event) {
.
# I show only the last bit of what this function does because calling update ajax().update( might cause the problem?
.
        JsfUtil.addSuccessMessage("Saved " + percs.stream().map(p -> perceelConverter.getAsString(null, null, p)).collect(Collectors.joining()));
        List<String> pfupdates = new ArrayList<>(3);
        if (gemStatusChange) pfupdates.add("menuform");            
        if (nieuwPerceel) {
            PrimeFaces.current().executeScript("sc();");
        } else {
            pfupdates.add("buttons");            
        }
        if (!pfupdates.isEmpty()) PrimeFaces.current().ajax().update(pfupdates);
    }

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
eduarddrenthcommented, Apr 25, 2022

Yes, therefore cellselect event is async=true, change event is async=false, change method is synchronized, jpa and optimistic locking garantee data integrity, this probably fixes the issue (awaiting testers)

1reaction
eduarddrenthcommented, Jun 4, 2022

This issue I solved like this:

  • in xhtml make cellSelect call asynchronous async=“true”-
<p:ajax event="change" update="@none" listener="#{perceelSheetController.cellChangeEvent}" 
                        onerror="window.setTimeout(function() {focusFirstSheetError('sheetWidget');}, 200);"/>
<p:ajax event="cellSelect" async="true" update="@none" listener="#{perceelSheetController.cellSelectEvent}"/>
  • in Java bean make change method synchronized:
    public synchronized void cellChangeEvent(final SheetEvent event) {
Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve "Excel Running Slow" Problem [8 Proven Ways]
Another symptom of Excel running very slow is there is a performance issue in doing the calculation. Poor calculation speed further affects productivity...
Read more >
6 Circumstances that Would Cause Data Loss in MS Excel ...
Hardware problems - your hardware, such as memory or RAM, could misbehave and cause Excel to stop working and lose your data in...
Read more >
7 Excel Spreadsheet Problems and How to Solve Them - Alphr
1. When Excel systems grow organically, you quickly run into problems where one user opens a workbook at any particular time, and a...
Read more >
How to fix Microsoft Excel not responding error and save your ...
Open the Excel file and check if it still crashes. If not, the problem could be a faulty add-in or formatting and styling...
Read more >
Losing Data in a Shared Workbook - Microsoft Excel Tips
Karen described a problem in which a shared workbook, stored on a company network, periodically loses all the data it previously contained.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found