Sp-starter-kit: Alert Notification: API bug

Created on 10 Jun 2020  路  5Comments  路  Source: pnp/sp-starter-kit

Category

  • [x] Bug

Describe the bug

The API call to the Alerts list is not getting correctly filtered results.

Expected or Desired Behavior

Get correctly filtered items from the Alerts list.

Observed Behavior

The API call which is getting the items from the Alerts list is not working properly because in the source code the call is broken down in multiple lines which is interpreted as white space in Sharepoint. It has to be in one line to work properly or have a "+" at the end of each line. Note that I have only tested this in Chrome, other browsers might interpret this correctly.

Steps to Reproduce

Create an item in the Alerts list and in the End date-time column insert a date and time which has already passed and notice that the alert at the top does not go away.

Environment Details (Development & Target environment)

  • Starter kit version: [e.g. v2 for current version, v1 for legacy solution]
  • OS: [e.g. Windows 10 | MacOS 10.15.x]
  • Target Environment:[SharePoint Server 2019 | SharePoint Online]
  • Framework: [Node.js v6/v8/v10/v12]
  • Browser(s): [e.g. Chrome v79 | Safari v22 | FireFox v31 | IE v11 | Edge | Chromium Edge v79]
  • Additional details: The more context you can provide, the easier it is (and therefore quicker) to help.

Thanks for your contribution! Sharing is caring.

code fixed SharePoint Online V2

Most helpful comment

Thank you for reporting this. We'll take a look!

All 5 comments

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

Great catch!
I can also see this behavior.

Thank you for reporting this. We'll take a look!

@karigeir Very good catch, interesting. This has been fixed and committed to this repo. You can pull the latest master branch and simply replace the sppkg for this particular extension in your tenant app catalog, or you could reinstall the entire solution I suppose.

Side note, when using ` instead of ' or " in TypeScript, you can use multi-line strings with closing each line and added +. The catch here is that when the TS compiler turns that into valid JS, a new line i.e. n, is added to each line. That causes the query to be a mess. The fix was to simply replace with standard formatted JS strings, with the +.

Thanks again for finding this. I'll leave this issue open for a few days in case you have a moment to confirm the fix worked for you.

@eoverfield Thanks for the reply, this is the same solution I used to get it to work so I can confirm this does the trick :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonasbjor picture jonasbjor  路  8Comments

VesaJuvonen picture VesaJuvonen  路  5Comments

metkhoo picture metkhoo  路  5Comments

bergersj picture bergersj  路  8Comments

GeoffE1e6 picture GeoffE1e6  路  5Comments