Online Paco Sako single-page progressive web app
Go to file
Jesse D. McDonald 7ebea1d1fc restructure data to limit indirect links; breaking change
I found that the game list was wiped out (again) and I suspect that the
issue was that some client pushed an update to the game list before
receiving the current data for the top-level object. That would have
caused it to create new objects for the game and metadata lists
containing only the single newly-created game and store links to them in
the 'games' and 'meta' fields of the top-level object. This data would
not be merged because the new objects have no connection to the original
objects which should have been linked from those fields. The top-level
object would be merged, but only to the extent of updating the links.

To fix this, I moved the 'meta' object to the top level with a fixed
identifier (UUID + '/meta'). This identifier _is_ the object's identity
("soul") so even if a client initializes it with an empty object the new
fields should be merged when syncing resumes. I removed the 'games'
object altogether, since the meta object keeps track of which game IDs
are available. Individual games are assigned "souls" based on their game
IDs (UUID + ('/game/' or '/meta/') + game ID). The resulting structure
looks like:

    'UUID/meta': {
      '12345abcde': <link to 'UUID/meta/12345abcde'>,
      '3a2b5c7e1f': <link to 'UUID/meta/3a2b5c7e1f'>,
      ...
    },
    'UUID/meta/12345abcde': { ... darkName, lightName, moves, etc. ... },
    'UUID/game/12345abcde': { 'board': 'JSON' },
    'UUID/meta/3a2b5c7e1f': { ... darkName, lightName, moves, etc. ... },
    'UUID/game/3a2b5c7e1f': { 'board': 'JSON' },
    ...

Besides being more resilient, this structure should also be more
performant since there are fewer links to traverse to access the game
data. So far in my admittedly limited testing I haven't seen any of the
syncronization issues that plagued the older version.
2020-04-04 05:24:59 -05:00
css adjust badge layout to avoid overlap & add tooltips 2020-03-29 20:12:32 -05:00
js restructure data to limit indirect links; breaking change 2020-04-04 05:24:59 -05:00
png add badges linking to the official site and the Gogs repo 2020-03-29 15:09:05 -05:00
svg integrate SVG optimization with webpack 2020-04-02 03:05:52 -05:00
.gitignore fix remaining hard-coded paths & extend cache lifetimes with content hashes 2020-04-02 05:25:49 -05:00
.htaccess fix remaining hard-coded paths & extend cache lifetimes with content hashes 2020-04-02 05:25:49 -05:00
index.html fix remaining hard-coded paths & extend cache lifetimes with content hashes 2020-04-02 05:25:49 -05:00
index.js fix remaining hard-coded paths & extend cache lifetimes with content hashes 2020-04-02 05:25:49 -05:00
package-lock.json fix remaining hard-coded paths & extend cache lifetimes with content hashes 2020-04-02 05:25:49 -05:00
package.json fix remaining hard-coded paths & extend cache lifetimes with content hashes 2020-04-02 05:25:49 -05:00
sw.js add notifications for new moves through a service worker 2020-03-11 22:40:03 -05:00
webpack.config.js restructure data to limit indirect links; breaking change 2020-04-04 05:24:59 -05:00